@@ -206,7 +206,8 @@ VideoDecoder::BatchDecodedOutput::BatchDecodedOutput(
206206
207207bool VideoDecoder::DecodedFrameContext::operator ==(
208208 const VideoDecoder::DecodedFrameContext& other) {
209- return decodedWidth == other.decodedWidth && decodedHeight == decodedHeight &&
209+ return decodedWidth == other.decodedWidth &&
210+ decodedHeight == other.decodedHeight &&
210211 decodedFormat == other.decodedFormat &&
211212 expectedWidth == other.expectedWidth &&
212213 expectedHeight == other.expectedHeight ;
@@ -251,12 +252,12 @@ void VideoDecoder::initializeDecoder() {
251252 getFFMPEGErrorStringFromErrorCode (ffmpegStatus));
252253 }
253254
254- for (int i = 0 ; i < formatContext_->nb_streams ; i++) {
255+ for (unsigned int i = 0 ; i < formatContext_->nb_streams ; i++) {
255256 AVStream* stream = formatContext_->streams [i];
256257 StreamMetadata meta;
257258
258259 TORCH_CHECK (
259- i == stream->index ,
260+ static_cast < int >(i) == stream->index ,
260261 " Our stream index, " + std::to_string (i) +
261262 " , does not match AVStream's index, " +
262263 std::to_string (stream->index ) + " ." );
@@ -611,7 +612,7 @@ void VideoDecoder::scanFileAndUpdateMetadataAndIndex() {
611612
612613 // Set all per-stream metadata that requires knowing the content of all
613614 // packets.
614- for (int i = 0 ; i < containerMetadata_.streams .size (); ++i) {
615+ for (size_t i = 0 ; i < containerMetadata_.streams .size (); ++i) {
615616 auto & streamMetadata = containerMetadata_.streams [i];
616617 auto stream = formatContext_->streams [i];
617618
@@ -651,7 +652,7 @@ void VideoDecoder::scanFileAndUpdateMetadataAndIndex() {
651652 return frameInfo1.pts < frameInfo2.pts ;
652653 });
653654
654- for (int i = 0 ; i < stream.allFrames .size (); ++i) {
655+ for (size_t i = 0 ; i < stream.allFrames .size (); ++i) {
655656 if (i + 1 < stream.allFrames .size ()) {
656657 stream.allFrames [i].nextPts = stream.allFrames [i + 1 ].pts ;
657658 }
@@ -1094,8 +1095,8 @@ VideoDecoder::DecodedOutput VideoDecoder::getFramePlayedAtTimestampNoDemux(
10941095 return output;
10951096}
10961097
1097- void VideoDecoder::validateUserProvidedStreamIndex (uint64_t streamIndex) {
1098- size_t streamsSize = containerMetadata_.streams .size ();
1098+ void VideoDecoder::validateUserProvidedStreamIndex (int streamIndex) {
1099+ int streamsSize = static_cast < int >( containerMetadata_.streams .size () );
10991100 TORCH_CHECK (
11001101 streamIndex >= 0 && streamIndex < streamsSize,
11011102 " Invalid stream index=" + std::to_string (streamIndex) +
@@ -1272,9 +1273,10 @@ VideoDecoder::BatchDecodedOutput VideoDecoder::getFramesAtIndices(
12721273 BatchDecodedOutput output (frameIndices.size (), options, streamMetadata);
12731274
12741275 auto previousIndexInVideo = -1 ;
1275- for (auto f = 0 ; f < frameIndices.size (); ++f) {
1276+ for (size_t f = 0 ; f < frameIndices.size (); ++f) {
12761277 auto indexInOutput = indicesAreSorted ? f : argsort[f];
12771278 auto indexInVideo = frameIndices[indexInOutput];
1279+
12781280 validateFrameIndex (streamMetadata, indexInVideo);
12791281
12801282 if ((f > 0 ) && (indexInVideo == previousIndexInVideo)) {
@@ -1314,7 +1316,7 @@ VideoDecoder::BatchDecodedOutput VideoDecoder::getFramesPlayedByTimestamps(
13141316 // to indices, and leverage the de-duplication logic of getFramesAtIndices.
13151317
13161318 std::vector<int64_t > frameIndices (timestamps.size ());
1317- for (auto i = 0 ; i < timestamps.size (); ++i) {
1319+ for (size_t i = 0 ; i < timestamps.size (); ++i) {
13181320 auto frameSeconds = timestamps[i];
13191321 TORCH_CHECK (
13201322 frameSeconds >= minSeconds && frameSeconds < maxSeconds,
0 commit comments