[FFmpeg-cvslog] mpegtsenc: Take max_delay into account when buffering multiple audio packets into one PES packet
Martin Storsjö
git at videolan.org
Fri Apr 3 21:09:18 CEST 2015
ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Thu Apr 2 11:09:31 2015 +0300| [7d097a0fc57f0fa8385962a539c657c2f40b5ed0] | committer: Martin Storsjö
mpegtsenc: Take max_delay into account when buffering multiple audio packets into one PES packet
Make sure we don't buffer up more than max_delay worth of data
before writing a PES packet, even if pes_payload_size is set to
a larger value.
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7d097a0fc57f0fa8385962a539c657c2f40b5ed0
---
libavformat/mpegtsenc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index de6e6ac..28b700e 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1128,7 +1128,10 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
return 0;
}
- if (ts_st->payload_size + size > ts->pes_payload_size) {
+ if (ts_st->payload_size + size > ts->pes_payload_size ||
+ (dts != AV_NOPTS_VALUE && ts_st->payload_dts != AV_NOPTS_VALUE &&
+ av_compare_ts(dts - ts_st->payload_dts, st->time_base,
+ s->max_delay, AV_TIME_BASE_Q) >= 0)) {
if (ts_st->payload_size) {
mpegts_write_pes(s, st, ts_st->payload, ts_st->payload_size,
ts_st->payload_pts, ts_st->payload_dts,
More information about the ffmpeg-cvslog
mailing list