Skip to content

Commit 405b2e1

Browse files
committed
Change logging
1 parent b639a46 commit 405b2e1

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,9 +677,11 @@ void VideoDecoder::maybeSeekToBeforeDesiredPts() {
677677
int64_t desiredPtsForStream = *maybeDesiredPts_ * streamInfo.timeBase.den;
678678
if (!canWeAvoidSeekingForStream(
679679
streamInfo, streamInfo.currentPts, desiredPtsForStream)) {
680+
/*
680681
VLOG(5) << "Seeking is needed for streamIndex=" << streamIndex
681682
<< " desiredPts=" << desiredPtsForStream
682683
<< " currentPts=" << streamInfo.currentPts;
684+
*/
683685
mustSeek = true;
684686
break;
685687
}
@@ -729,15 +731,21 @@ VideoDecoder::RawDecodedOutput VideoDecoder::getDecodedOutputWithFilter(
729731
if (activeStreamIndices_.size() == 0) {
730732
throw std::runtime_error("No active streams configured.");
731733
}
734+
/*
732735
VLOG(9) << "Starting getDecodedOutputWithFilter()";
736+
*/
733737
resetDecodeStats();
734738
if (maybeDesiredPts_.has_value()) {
735739
std::cerr << "\thas value" << std::endl;
740+
/*
736741
VLOG(9) << "maybeDesiredPts_=" << *maybeDesiredPts_;
742+
*/
737743
std::cerr << "\tlogged pts" << std::endl;
738744
maybeSeekToBeforeDesiredPts();
739745
maybeDesiredPts_ = std::nullopt;
746+
/*
740747
VLOG(9) << "seeking done";
748+
*/
741749
}
742750
auto seekDone = std::chrono::high_resolution_clock::now();
743751
// Need to get the next frame or error from PopFrame.
@@ -752,13 +760,17 @@ VideoDecoder::RawDecodedOutput VideoDecoder::getDecodedOutputWithFilter(
752760
StreamInfo& streamInfo = streams_[streamIndex];
753761
ffmpegStatus =
754762
avcodec_receive_frame(streamInfo.codecContext.get(), frame.get());
763+
/*
755764
VLOG(9) << "received frame" << " status=" << ffmpegStatus
756765
<< " streamIndex=" << streamInfo.stream->index;
766+
*/
757767
bool gotNonRetriableError =
758768
ffmpegStatus != AVSUCCESS && ffmpegStatus != AVERROR(EAGAIN);
759769
if (gotNonRetriableError) {
770+
/*
760771
VLOG(9) << "Got non-retriable error from decoder: "
761772
<< getFFMPEGErrorStringFromErrorCode(ffmpegStatus);
773+
*/
762774
gotPermanentErrorOnAnyActiveStream = true;
763775
break;
764776
}
@@ -788,7 +800,9 @@ VideoDecoder::RawDecodedOutput VideoDecoder::getDecodedOutputWithFilter(
788800
UniqueAVPacket packet(av_packet_alloc());
789801
ffmpegStatus = av_read_frame(formatContext_.get(), packet.get());
790802
decodeStats_.numPacketsRead++;
803+
/*
791804
VLOG(9) << "av_read_frame returned status: " << ffmpegStatus;
805+
*/
792806
if (ffmpegStatus == AVERROR_EOF) {
793807
// End of file reached. We must drain all codecs by sending a nullptr
794808
// packet.
@@ -811,8 +825,10 @@ VideoDecoder::RawDecodedOutput VideoDecoder::getDecodedOutputWithFilter(
811825
"Could not read frame from input file: " +
812826
getFFMPEGErrorStringFromErrorCode(ffmpegStatus));
813827
}
828+
/*
814829
VLOG(9) << "Got packet: stream_index=" << packet->stream_index
815830
<< " pts=" << packet->pts << " size=" << packet->size;
831+
*/
816832
if (activeStreamIndices_.count(packet->stream_index) == 0) {
817833
// This packet is not for any of the active streams.
818834
continue;
@@ -850,10 +866,12 @@ VideoDecoder::RawDecodedOutput VideoDecoder::getDecodedOutputWithFilter(
850866
std::chrono::duration_cast<std::chrono::milliseconds>(seekDone - start);
851867
auto seekToDecodeDone = std::chrono::duration_cast<std::chrono::milliseconds>(
852868
decodeDone - seekDone);
869+
/*
853870
VLOG(3) << "Got frame: stream_index=" << activeStream.stream->index
854871
<< " pts=" << frame->pts << " stats=" << decodeStats_
855872
<< " startToSeekDone=" << startToSeekDone.count() << "ms"
856873
<< " seekToDecodeDone=" << seekToDecodeDone.count() << "ms";
874+
*/
857875
RawDecodedOutput rawOutput;
858876
rawOutput.streamIndex = frameStreamIndex;
859877
rawOutput.frame = std::move(frame);

src/torchcodec/decoders/_core/VideoDecoderOps.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,14 @@ bool _test_frame_pts_equality(
283283
int64_t frame_index,
284284
double pts_seconds_to_test) {
285285
auto videoDecoder = unwrapTensorToGetDecoder(decoder);
286+
/*
286287
LOG(INFO) << "pts_seconds_to_test: " << std::setprecision(15)
287288
<< pts_seconds_to_test << std::endl;
288289
LOG(INFO) << "frame pts : " << std::setprecision(15)
289290
<< videoDecoder->getPtsSecondsForFrame(stream_index, frame_index)
290291
<< std::endl
291292
<< std::endl;
293+
*/
292294
return pts_seconds_to_test ==
293295
videoDecoder->getPtsSecondsForFrame(stream_index, frame_index);
294296
}

0 commit comments

Comments
 (0)