@@ -657,7 +657,6 @@ bool VideoDecoder::canWeAvoidSeekingForStream(
657657// AVFormatContext if it is needed. We can skip seeking in certain cases. See
658658// the comment of canWeAvoidSeeking() for details.
659659void VideoDecoder::maybeSeekToBeforeDesiredPts () {
660- std::cerr << " maybeSeekToBeforeDesiredPts" << std::endl;
661660 if (activeStreamIndices_.size () == 0 ) {
662661 return ;
663662 }
@@ -677,9 +676,6 @@ void VideoDecoder::maybeSeekToBeforeDesiredPts() {
677676 int64_t desiredPtsForStream = *maybeDesiredPts_ * streamInfo.timeBase .den ;
678677 if (!canWeAvoidSeekingForStream (
679678 streamInfo, streamInfo.currentPts , desiredPtsForStream)) {
680- VLOG (5 ) << " Seeking is needed for streamIndex=" << streamIndex
681- << " desiredPts=" << desiredPtsForStream
682- << " currentPts=" << streamInfo.currentPts ;
683679 mustSeek = true ;
684680 break ;
685681 }
@@ -724,20 +720,14 @@ void VideoDecoder::maybeSeekToBeforeDesiredPts() {
724720
725721VideoDecoder::RawDecodedOutput VideoDecoder::getDecodedOutputWithFilter (
726722 std::function<bool (int , AVFrame*)> filterFunction) {
727- std::cerr << " getDecodedOutputWithFilter" << std::endl;
728723 auto start = std::chrono::high_resolution_clock::now ();
729724 if (activeStreamIndices_.size () == 0 ) {
730725 throw std::runtime_error (" No active streams configured." );
731726 }
732- VLOG (9 ) << " Starting getDecodedOutputWithFilter()" ;
733727 resetDecodeStats ();
734728 if (maybeDesiredPts_.has_value ()) {
735- std::cerr << " \t has value" << std::endl;
736- VLOG (9 ) << " maybeDesiredPts_=" << *maybeDesiredPts_;
737- std::cerr << " \t logged pts" << std::endl;
738729 maybeSeekToBeforeDesiredPts ();
739730 maybeDesiredPts_ = std::nullopt ;
740- VLOG (9 ) << " seeking done" ;
741731 }
742732 auto seekDone = std::chrono::high_resolution_clock::now ();
743733 // Need to get the next frame or error from PopFrame.
@@ -752,13 +742,9 @@ VideoDecoder::RawDecodedOutput VideoDecoder::getDecodedOutputWithFilter(
752742 StreamInfo& streamInfo = streams_[streamIndex];
753743 ffmpegStatus =
754744 avcodec_receive_frame (streamInfo.codecContext .get (), frame.get ());
755- VLOG (9 ) << " received frame" << " status=" << ffmpegStatus
756- << " streamIndex=" << streamInfo.stream ->index ;
757745 bool gotNonRetriableError =
758746 ffmpegStatus != AVSUCCESS && ffmpegStatus != AVERROR (EAGAIN);
759747 if (gotNonRetriableError) {
760- VLOG (9 ) << " Got non-retriable error from decoder: "
761- << getFFMPEGErrorStringFromErrorCode (ffmpegStatus);
762748 gotPermanentErrorOnAnyActiveStream = true ;
763749 break ;
764750 }
@@ -788,7 +774,6 @@ VideoDecoder::RawDecodedOutput VideoDecoder::getDecodedOutputWithFilter(
788774 UniqueAVPacket packet (av_packet_alloc ());
789775 ffmpegStatus = av_read_frame (formatContext_.get (), packet.get ());
790776 decodeStats_.numPacketsRead ++;
791- VLOG (9 ) << " av_read_frame returned status: " << ffmpegStatus;
792777 if (ffmpegStatus == AVERROR_EOF) {
793778 // End of file reached. We must drain all codecs by sending a nullptr
794779 // packet.
@@ -811,8 +796,6 @@ VideoDecoder::RawDecodedOutput VideoDecoder::getDecodedOutputWithFilter(
811796 " Could not read frame from input file: " +
812797 getFFMPEGErrorStringFromErrorCode (ffmpegStatus));
813798 }
814- VLOG (9 ) << " Got packet: stream_index=" << packet->stream_index
815- << " pts=" << packet->pts << " size=" << packet->size ;
816799 if (activeStreamIndices_.count (packet->stream_index ) == 0 ) {
817800 // This packet is not for any of the active streams.
818801 continue ;
@@ -850,10 +833,6 @@ VideoDecoder::RawDecodedOutput VideoDecoder::getDecodedOutputWithFilter(
850833 std::chrono::duration_cast<std::chrono::milliseconds>(seekDone - start);
851834 auto seekToDecodeDone = std::chrono::duration_cast<std::chrono::milliseconds>(
852835 decodeDone - seekDone);
853- VLOG (3 ) << " Got frame: stream_index=" << activeStream.stream ->index
854- << " pts=" << frame->pts << " stats=" << decodeStats_
855- << " startToSeekDone=" << startToSeekDone.count () << " ms"
856- << " seekToDecodeDone=" << seekToDecodeDone.count () << " ms" ;
857836 RawDecodedOutput rawOutput;
858837 rawOutput.streamIndex = frameStreamIndex;
859838 rawOutput.frame = std::move (frame);
@@ -1021,7 +1000,6 @@ VideoDecoder::DecodedOutput VideoDecoder::getFrameAtIndex(
10211000 int streamIndex,
10221001 int64_t frameIndex,
10231002 std::optional<torch::Tensor> preAllocatedOutputTensor) {
1024- std::cerr << " getFrameAtIndex" << std::endl;
10251003 validateUserProvidedStreamIndex (streamIndex);
10261004 validateScannedAllStreams (" getFrameAtIndex" );
10271005
@@ -1196,7 +1174,6 @@ VideoDecoder::getFramesDisplayedByTimestampInRange(
11961174}
11971175
11981176VideoDecoder::RawDecodedOutput VideoDecoder::getNextRawDecodedOutputNoDemux () {
1199- std::cerr << " getNextRawDecodedOutputNoDemux" << std::endl;
12001177 auto rawOutput =
12011178 getDecodedOutputWithFilter ([this ](int frameStreamIndex, AVFrame* frame) {
12021179 StreamInfo& activeStream = streams_[frameStreamIndex];
@@ -1207,7 +1184,6 @@ VideoDecoder::RawDecodedOutput VideoDecoder::getNextRawDecodedOutputNoDemux() {
12071184
12081185VideoDecoder::DecodedOutput VideoDecoder::getNextDecodedOutputNoDemux (
12091186 std::optional<torch::Tensor> preAllocatedOutputTensor) {
1210- std::cerr << " getNextDecodedOutputNoDemux" << std::endl;
12111187 auto rawOutput = getNextRawDecodedOutputNoDemux ();
12121188 return convertAVFrameToDecodedOutput (rawOutput, preAllocatedOutputTensor);
12131189}
0 commit comments