mirror of
https://github.com/librempeg/librempeg
synced 2024-11-23 03:28:27 +00:00
fftools/ffmpeg: Integrate two checks
For audio packets with dts != AV_NOPTS_VALUEs the dts was converted twice to the muxer's timebase during streamcopy, once as a normal packet and once specifically as an audio packet. This has been changed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
568d62117d
commit
13dc90396d
@ -2048,20 +2048,20 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
|
||||
if (pkt->pts != AV_NOPTS_VALUE)
|
||||
opkt.pts = av_rescale_q(pkt->pts, ist->st->time_base, ost->mux_timebase) - ost_tb_start_time;
|
||||
|
||||
if (pkt->dts == AV_NOPTS_VALUE)
|
||||
if (pkt->dts == AV_NOPTS_VALUE) {
|
||||
opkt.dts = av_rescale_q(ist->dts, AV_TIME_BASE_Q, ost->mux_timebase);
|
||||
else
|
||||
opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->mux_timebase);
|
||||
opkt.dts -= ost_tb_start_time;
|
||||
|
||||
if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && pkt->dts != AV_NOPTS_VALUE) {
|
||||
} else if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
int duration = av_get_audio_frame_duration(ist->dec_ctx, pkt->size);
|
||||
if(!duration)
|
||||
duration = ist->dec_ctx->frame_size;
|
||||
opkt.dts = opkt.pts = av_rescale_delta(ist->st->time_base, pkt->dts,
|
||||
(AVRational){1, ist->dec_ctx->sample_rate}, duration, &ist->filter_in_rescale_delta_last,
|
||||
ost->mux_timebase) - ost_tb_start_time;
|
||||
}
|
||||
opkt.dts = av_rescale_delta(ist->st->time_base, pkt->dts,
|
||||
(AVRational){1, ist->dec_ctx->sample_rate}, duration,
|
||||
&ist->filter_in_rescale_delta_last, ost->mux_timebase);
|
||||
/* dts will be set immediately afterwards to what pts is now */
|
||||
opkt.pts = opkt.dts - ost_tb_start_time;
|
||||
} else
|
||||
opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->mux_timebase);
|
||||
opkt.dts -= ost_tb_start_time;
|
||||
|
||||
opkt.duration = av_rescale_q(pkt->duration, ist->st->time_base, ost->mux_timebase);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user