File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
src/torchcodec/decoders/_core Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -1275,10 +1275,8 @@ VideoDecoder::BatchDecodedOutput VideoDecoder::getFramesAtIndices(
12751275 for (auto f = 0 ; f < frameIndices.size (); ++f) {
12761276 auto indexInOutput = indicesAreSorted ? f : argsort[f];
12771277 auto indexInVideo = frameIndices[indexInOutput];
1278- if (indexInVideo < 0 || indexInVideo >= getNumFrames (streamMetadata)) {
1279- throw std::runtime_error (
1280- " Invalid frame index=" + std::to_string (indexInVideo));
1281- }
1278+ validateFrameIndex (streamMetadata, indexInVideo);
1279+
12821280 if ((f > 0 ) && (indexInVideo == previousIndexInVideo)) {
12831281 // Avoid decoding the same frame twice
12841282 auto previousIndexInOutput = indicesAreSorted ? f - 1 : argsort[f - 1 ];
You can’t perform that action at this time.
0 commit comments