Signed-off-by: Marton Balint <c...@passwd.hu>
---
 libavformat/mpegtsenc.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index d8a74f4fe1..df015f588d 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1255,26 +1255,26 @@ static void mpegts_write_pes(AVFormatContext *s, 
AVStream *st,
                     ts->m2ts_last_pcr = FFMAX(pcr - ts->m2ts_pcr_period, 
ts->m2ts_last_pcr + ts->m2ts_pcr_period);
                     next_pcr = FFMIN(next_pcr, ts->m2ts_last_pcr + 
ts->m2ts_pcr_period);
                 } else {
-                for (int i = 0; i < s->nb_streams; i++) {
-                    /* Make the current stream the last, because for that we
-                     * can insert the pcr into the payload later */
-                    int st2_index = i < st->index ? i : (i + 1 == 
s->nb_streams ? st->index : i + 1);
-                    AVStream *st2 = s->streams[st2_index];
-                    MpegTSWriteStream *ts_st2 = st2->priv_data;
-                    if (ts_st2->pcr_period) {
-                        if (pcr - ts_st2->last_pcr >= ts_st2->pcr_period) {
-                            ts_st2->last_pcr = FFMAX(pcr - ts_st2->pcr_period, 
ts_st2->last_pcr + ts_st2->pcr_period);
-                            if (st2 != st) {
-                                mpegts_insert_pcr_only_for_stream(s, st2);
-                                pcr = get_pcr(ts, s->pb);
-                            } else {
-                                write_pcr = 1;
+                    for (int i = 0; i < s->nb_streams; i++) {
+                        /* Make the current stream the last, because for that 
we
+                         * can insert the pcr into the payload later */
+                        int st2_index = i < st->index ? i : (i + 1 == 
s->nb_streams ? st->index : i + 1);
+                        AVStream *st2 = s->streams[st2_index];
+                        MpegTSWriteStream *ts_st2 = st2->priv_data;
+                        if (ts_st2->pcr_period) {
+                            if (pcr - ts_st2->last_pcr >= ts_st2->pcr_period) {
+                                ts_st2->last_pcr = FFMAX(pcr - 
ts_st2->pcr_period, ts_st2->last_pcr + ts_st2->pcr_period);
+                                if (st2 != st) {
+                                    mpegts_insert_pcr_only_for_stream(s, st2);
+                                    pcr = get_pcr(ts, s->pb);
+                                } else {
+                                    write_pcr = 1;
+                                }
                             }
+                            next_pcr = FFMIN(next_pcr, ts_st2->last_pcr + 
ts_st2->pcr_period);
                         }
-                        next_pcr = FFMIN(next_pcr, ts_st2->last_pcr + 
ts_st2->pcr_period);
                     }
                 }
-                }
                 ts->next_pcr = next_pcr;
             }
             if (dts != AV_NOPTS_VALUE && (dts - pcr / 300) > delay) {
-- 
2.16.4

_______________________________________________
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".

Reply via email to