Skip to content

Commit 288bb83

Browse files
NicolasHugscotts
andauthored
Remove getNextAVFrameNoDemux() (#470)
Co-authored-by: Scott Schneider <scott.a.s@gmail.com>
1 parent a322334 commit 288bb83

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,15 +1472,6 @@ VideoDecoder::FrameBatchOutput VideoDecoder::getFramesPlayedInRange(
14721472
return frameBatchOutput;
14731473
}
14741474

1475-
VideoDecoder::AVFrameStream VideoDecoder::getNextAVFrameNoDemux() {
1476-
auto avFrameStream = getAVFrameUsingFilterFunction(
1477-
[this](int frameStreamIndex, AVFrame* avFrame) {
1478-
StreamInfo& activeStreamInfo = streamInfos_[frameStreamIndex];
1479-
return avFrame->pts >= activeStreamInfo.discardFramesBeforePts;
1480-
});
1481-
return avFrameStream;
1482-
}
1483-
14841475
VideoDecoder::FrameOutput VideoDecoder::getNextFrameNoDemux() {
14851476
auto output = getNextFrameNoDemuxInternal();
14861477
output.data = maybePermuteHWC2CHW(output.streamIndex, output.data);
@@ -1489,7 +1480,11 @@ VideoDecoder::FrameOutput VideoDecoder::getNextFrameNoDemux() {
14891480

14901481
VideoDecoder::FrameOutput VideoDecoder::getNextFrameNoDemuxInternal(
14911482
std::optional<torch::Tensor> preAllocatedOutputTensor) {
1492-
auto avFrameStream = getNextAVFrameNoDemux();
1483+
AVFrameStream avFrameStream = getAVFrameUsingFilterFunction(
1484+
[this](int frameStreamIndex, AVFrame* avFrame) {
1485+
StreamInfo& activeStreamInfo = streamInfos_[frameStreamIndex];
1486+
return avFrame->pts >= activeStreamInfo.discardFramesBeforePts;
1487+
});
14931488
return convertAVFrameToFrameOutput(avFrameStream, preAllocatedOutputTensor);
14941489
}
14951490

src/torchcodec/decoders/_core/VideoDecoder.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ class VideoDecoder {
403403
void maybeSeekToBeforeDesiredPts();
404404
AVFrameStream getAVFrameUsingFilterFunction(
405405
std::function<bool(int, AVFrame*)>);
406-
AVFrameStream getNextAVFrameNoDemux();
407406
// Once we create a decoder can update the metadata with the codec context.
408407
// For example, for video streams, we can add the height and width of the
409408
// decoded stream.

0 commit comments

Comments
 (0)