From 5baa9fc5b67b4fd4e6a191fe51f8c53aab0b587a Mon Sep 17 00:00:00 2001 From: Scott Schneider Date: Wed, 16 Oct 2024 08:06:57 -0700 Subject: [PATCH] Remove unnecessary optionality --- src/torchcodec/decoders/_core/VideoDecoder.cpp | 2 +- src/torchcodec/decoders/_core/VideoDecoder.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/torchcodec/decoders/_core/VideoDecoder.cpp b/src/torchcodec/decoders/_core/VideoDecoder.cpp index 58a605fd..63abee3a 100644 --- a/src/torchcodec/decoders/_core/VideoDecoder.cpp +++ b/src/torchcodec/decoders/_core/VideoDecoder.cpp @@ -1168,7 +1168,7 @@ VideoDecoder::RawDecodedOutput VideoDecoder::getNextRawDecodedOutputNoDemux() { getDecodedOutputWithFilter([this](int frameStreamIndex, AVFrame* frame) { StreamInfo& activeStream = streams_[frameStreamIndex]; return frame->pts >= - activeStream.discardFramesBeforePts.value_or(INT64_MIN); + activeStream.discardFramesBeforePts; }); return rawOutput; } diff --git a/src/torchcodec/decoders/_core/VideoDecoder.h b/src/torchcodec/decoders/_core/VideoDecoder.h index 8535a61e..c4da3c61 100644 --- a/src/torchcodec/decoders/_core/VideoDecoder.h +++ b/src/torchcodec/decoders/_core/VideoDecoder.h @@ -307,8 +307,8 @@ class VideoDecoder { int64_t currentDuration = 0; // The desired position of the cursor in the stream. We send frames >= // this pts to the user when they request a frame. - // We set this field if the user requested a seek. - std::optional discardFramesBeforePts = 0; + // We update this field if the user requested a seek. + int64_t discardFramesBeforePts = INT64_MIN; VideoStreamDecoderOptions options; // The filter state associated with this stream (for video streams). The // actual graph will be nullptr for inactive streams.