[FFmpeg-cvslog] avformat/mpegtsenc: move some code around and simplify a bit
Marton Balint
git at videolan.org
Sat Aug 24 00:13:20 EEST 2019
ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Thu Aug 15 00:51:10 2019 +0200| [5c119bf189c3a8806991e6909f9dfc2686189e5e] | committer: Marton Balint
avformat/mpegtsenc: move some code around and simplify a bit
PCR does not need to be recalcualted for CBR when inserting a NULL or PCR only
packet.
Signed-off-by: Marton Balint <cus at passwd.hu>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5c119bf189c3a8806991e6909f9dfc2686189e5e
---
libavformat/mpegtsenc.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 4ff8725c7c..a72242fae6 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1221,6 +1221,15 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
}
ts->next_pcr = next_pcr;
}
+ if (dts != AV_NOPTS_VALUE && (dts - pcr / 300) > delay) {
+ /* pcr insert gets priority over null packet insert */
+ if (write_pcr)
+ mpegts_insert_pcr_only(s, st);
+ else
+ mpegts_insert_null_packet(s);
+ /* recalculate write_pcr and possibly retransmit si_info */
+ continue;
+ }
} else if (ts_st->pcr_period && dts != AV_NOPTS_VALUE) {
pcr = (dts - delay) * 300;
if (pcr - ts_st->last_pcr >= ts_st->pcr_period && is_start) {
@@ -1229,17 +1238,6 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
}
}
- if (ts->mux_rate > 1 && dts != AV_NOPTS_VALUE &&
- (dts - get_pcr(ts, s->pb) / 300) > delay) {
- /* pcr insert gets priority over null packet insert */
- if (write_pcr)
- mpegts_insert_pcr_only(s, st);
- else
- mpegts_insert_null_packet(s);
- /* recalculate write_pcr and possibly retransmit si_info */
- continue;
- }
-
/* prepare packet header */
q = buf;
*q++ = 0x47;
More information about the ffmpeg-cvslog
mailing list