@@ -435,7 +435,9 @@ int VideoDecoder::getBestStreamIndex(AVMediaType mediaType) {
435435void VideoDecoder::addVideoStreamDecoder (
436436 int preferredStreamIndex,
437437 const VideoStreamOptions& videoStreamOptions) {
438- TORCH_CHECK (activeStreamIndex_ == -1 , " Can only add one single stream." );
438+ TORCH_CHECK (
439+ activeStreamIndex_ == NO_ACTIVE_STREAM,
440+ " Can only add one single stream." );
439441 TORCH_CHECK (formatContext_.get () != nullptr );
440442
441443 AVCodecOnlyUseForCallingAVFindBestStream avCodec = nullptr ;
@@ -722,7 +724,7 @@ bool VideoDecoder::canWeAvoidSeekingForStream(
722724// AVFormatContext if it is needed. We can skip seeking in certain cases. See
723725// the comment of canWeAvoidSeeking() for details.
724726void VideoDecoder::maybeSeekToBeforeDesiredPts () {
725- if (activeStreamIndex_ == - 1 ) {
727+ if (activeStreamIndex_ == NO_ACTIVE_STREAM ) {
726728 return ;
727729 }
728730 StreamInfo& streamInfo = streamInfos_[activeStreamIndex_];
@@ -770,7 +772,7 @@ void VideoDecoder::maybeSeekToBeforeDesiredPts() {
770772
771773VideoDecoder::AVFrameStream VideoDecoder::decodeAVFrame (
772774 std::function<bool (AVFrame*)> filterFunction) {
773- if (activeStreamIndex_ == - 1 ) {
775+ if (activeStreamIndex_ == NO_ACTIVE_STREAM ) {
774776 throw std::runtime_error (" No active streams configured." );
775777 }
776778
0 commit comments