better debugging of timebase

This commit is contained in:
Isaac Connor 2016-09-21 10:56:09 -04:00
parent 091459004c
commit 4359c65601
2 changed files with 15 additions and 6 deletions

View File

@ -437,8 +437,7 @@ void zm_dump_stream_format(AVFormatContext *ic, int i, int index, int is_output)
Debug(1, "[0x%x]", st->id); Debug(1, "[0x%x]", st->id);
if (lang) if (lang)
Debug(1, "(%s)", lang->value); Debug(1, "(%s)", lang->value);
av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames, Debug(1, ", %d, %d/%d", st->codec_info_nb_frames, st->time_base.num, st->time_base.den);
st->time_base.num, st->time_base.den);
Debug(1, ": %s", buf); Debug(1, ": %s", buf);
if (st->sample_aspect_ratio.num && // default if (st->sample_aspect_ratio.num && // default

View File

@ -357,17 +357,27 @@ if ( 1 ) {
Debug(3, "opkt.pts = undef"); Debug(3, "opkt.pts = undef");
opkt.pts = AV_NOPTS_VALUE; opkt.pts = AV_NOPTS_VALUE;
} }
}
//Scale the DTS of the outgoing packet to be the correct time base //Scale the DTS of the outgoing packet to be the correct time base
if(ipkt->dts == AV_NOPTS_VALUE) { if(ipkt->dts == AV_NOPTS_VALUE) {
if ( ! startDts ) startDts = input_video_stream->cur_dts; if ( ! startDts ) startDts = input_video_stream->cur_dts;
opkt.dts = av_rescale_q(input_video_stream->cur_dts-startDts, AV_TIME_BASE_Q, video_stream->time_base); opkt.dts = av_rescale_q(input_video_stream->cur_dts-startDts, AV_TIME_BASE_Q, video_stream->time_base);
Debug(3, "opkt.dts = %d from input_video_stream->cur_dts(%d) - startDts(%d), video_stream->time-base(%d)", opkt.dts, input_video_stream->cur_dts, startDts, video_stream->time_base ); Debug(3, "opkt.dts = %d from input_video_stream->cur_dts(%d) - startDts(%d), input time based(%d/%d) video_stream->time-base(%d/%d)",
opkt.dts, input_video_stream->cur_dts, startDts,
input_video_stream->time_base.num,
input_video_stream->time_base.den
video_stream->time_base.num,
video_stream->time_base.den
);
} else { } else {
if ( ! startDts ) startDts = ipkt->dts; if ( ! startDts ) startDts = ipkt->dts;
opkt.dts = av_rescale_q(ipkt->dts - startDts, input_video_stream->time_base, video_stream->time_base); opkt.dts = av_rescale_q(ipkt->dts - startDts, input_video_stream->time_base, video_stream->time_base);
Debug(3, "opkt.dts = %d from ipkt->dts(%d) - startDts(%d), video_stream->time-base(%d)", opkt.dts, ipkt->dts, startDts, video_stream->time_base ); Debug(3, "opkt.dts = %d from ipkt->dts(%d) - startDts(%d), input time base (%d/%d) video_stream->time-base(%d/%d)", opkt.dts, ipkt->dts, startDts,
input_video_stream->time_base.num,
input_video_stream->time_base.den
video_stream->time_base.num,
video_stream->time_base.den
);
} }
if ( opkt.dts > opkt.pts ) { if ( opkt.dts > opkt.pts ) {
Warning("opkt.dts(%d) must be <= opkt.pts(%d). Decompression must happen before presentation.", opkt.dts, opkt.pts ); Warning("opkt.dts(%d) must be <= opkt.pts(%d). Decompression must happen before presentation.", opkt.dts, opkt.pts );
@ -396,7 +406,7 @@ Debug(3, "video and RAWPICTURE");
opkt.size = sizeof(AVPicture); opkt.size = sizeof(AVPicture);
opkt.flags |= AV_PKT_FLAG_KEY; opkt.flags |= AV_PKT_FLAG_KEY;
} else { } else {
Debug(3, "Not video and RAWPICTURE"); Debug(4, "Not video and RAWPICTURE");
} }
//memcpy(&safepkt, &opkt, sizeof(AVPacket)); //memcpy(&safepkt, &opkt, sizeof(AVPacket));