[FFmpeg-devel] [PATCH v2 4/5] mpegtsenc: Don't periodically announce PCR on SCTE-35 streams

Marton Balint cus at passwd.hu
Mon Jul 3 22:17:36 EEST 2023



On Mon, 3 Jul 2023, Devin Heitmueller wrote:

> Changes were made between in the last two years to periodically
> send PCR-only packets on all PIDs, but for cases where the stream
> may send packets very infrequently (like SCTE-35), this results in
> extra TR101290 errors because it fails the PCR interval test.
>
> I am not quite sure what the "right" fix should be for this, but
> for now just disable all periodic sending of PCR-only packets on
> SCTE-35 streams.

Hmm, only one PID per service should generate PCR, and if there is a video 
stream in the service, then that is preferred for PCR generation. An SCTE 
stream should only get selected for PCR if there are no video streams in a 
service. Or are you seeing something else?

And it is also strange that not sending PCR for any stream improves the 
PCR interval test, it should make it worse, because less PCRs are 
provided, no?

Thanks,
Marton

>
> Signed-off-by: Devin Heitmueller <dheitmueller at ltnglobal.com>
> ---
> libavformat/mpegtsenc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
> index c6cd1fd..ba60582 100644
> --- a/libavformat/mpegtsenc.c
> +++ b/libavformat/mpegtsenc.c
> @@ -1579,7 +1579,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
>                     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 (ts_st2->pcr_period && st2->codecpar->codec_id != AV_CODEC_ID_SCTE_35) {
>                         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) {
> -- 
> 1.8.3.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list