mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-08-11 01:26:03 +00:00
avformat/demux: discard trimming samples in codecs with fixed frame size
When a demuxer reports the last packet with a duration smaller than the real coded duration, this information is not relayed to the decoder, which will happily output all the trimming samples anyway. Fix that by ensuring we export a discard padding information as side data. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@@ -1536,7 +1536,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt)
|
||||
if (sti->first_discard_sample && pkt->pts != AV_NOPTS_VALUE) {
|
||||
int64_t pts = pkt->pts - (is_relative(pkt->pts) ? RELATIVE_TS_BASE : 0);
|
||||
int64_t sample = ts_to_samples(st, pts);
|
||||
int64_t duration = ts_to_samples(st, pkt->duration);
|
||||
int64_t duration = FFMAX(st->codecpar->frame_size, ts_to_samples(st, pkt->duration));
|
||||
int64_t end_sample = sample + duration;
|
||||
if (duration > 0 && end_sample >= sti->first_discard_sample &&
|
||||
sample < sti->last_discard_sample)
|
||||
|
||||
Reference in New Issue
Block a user