On Sat, Oct 31, 2020 at 05:56:24PM +0100, Marton Balint wrote: > Fixes out of sync timestamps in ticket #8762. > > Signed-off-by: Marton Balint <c...@passwd.hu> > --- > libavformat/dv.c | 16 ++-------------- > tests/ref/seek/lavf-dv | 18 +++++++++--------- > 2 files changed, 11 insertions(+), 23 deletions(-) > > diff --git a/libavformat/dv.c b/libavformat/dv.c > index 3e0d12c0e3..26a78139f5 100644 > --- a/libavformat/dv.c > +++ b/libavformat/dv.c > @@ -49,7 +49,6 @@ struct DVDemuxContext { > uint8_t audio_buf[4][8192]; > int ach; > int frames; > - uint64_t abytes; > }; > > static inline uint16_t dv_audio_12to16(uint16_t sample) > @@ -258,7 +257,7 @@ static int dv_extract_audio_info(DVDemuxContext *c, const > uint8_t *frame) > c->ast[i] = avformat_new_stream(c->fctx, NULL); > if (!c->ast[i]) > break; > - avpriv_set_pts_info(c->ast[i], 64, 1, 30000); > + avpriv_set_pts_info(c->ast[i], 64, c->sys->time_base.num, > c->sys->time_base.den); > c->ast[i]->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; > c->ast[i]->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; > > @@ -387,8 +386,7 @@ int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket > *pkt, > for (i = 0; i < c->ach; i++) { > c->audio_pkt[i].pos = pos; > c->audio_pkt[i].size = size; > - c->audio_pkt[i].pts = c->abytes * 30000 * 8 / > - c->ast[i]->codecpar->bit_rate; > + c->audio_pkt[i].pts = (c->sys->height == 720) ? (c->frames & ~1) : > c->frames; > ppcm[i] = c->audio_buf[i]; > } > if (c->ach) > @@ -401,10 +399,7 @@ int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket > *pkt, > c->audio_pkt[2].size = c->audio_pkt[3].size = 0; > } else { > c->audio_pkt[0].size = c->audio_pkt[1].size = 0; > - c->abytes += size; > } > - } else { > - c->abytes += size; > } > > /* Now it's time to return video packet */
Please correct me if iam wrong but in cases where no audio is missing or damaged, this would also ignore how much audio is in each packet. So you could have lets say a timestamp difference of excatly 1 second between 2 packets while their is actually not exactly 1 second worth of audio samples between them. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have often repented speaking, but never of holding my tongue. -- Xenocrates
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".