aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2015-04-02 11:09:31 +0300
committerMartin Storsjö <martin@martin.st>2015-04-03 14:06:15 +0300
commit7d097a0fc57f0fa8385962a539c657c2f40b5ed0 (patch)
tree0465badb2e2dcb10118530f7a3e1aba885b8ccd2 /libavformat
parente3ec6fe7bb2a622a863e3912181717a659eb1bad (diff)
downloadffmpeg-7d097a0fc57f0fa8385962a539c657c2f40b5ed0.tar.gz
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@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mpegtsenc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index de6e6acab6..28b700e3be 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,