[mythtv] Call for testing branch devel/ffmpeg-resync (mpegts-harmonize)

Scott Theisen scott.the.elm at gmail.com
Tue Jul 26 19:09:49 UTC 2022

On 7/26/22 14:10, Scott Theisen wrote:
> Initial impression: probable double free 

I would like mythcommflag logs with `-v libav:debug` from both master 
and ffmpeg-resync.

It appears that since add_section_stream() reuses the SectionContext if 
it already exists, this leads to two DSMCC streams with the same value 
of the pointer priv_data which then is double freed since it is freed 
with each stream.

This should fix the double free, but I need you to test if the 
DSMCC/MHEG streams still work correctly since I can't:
diff --git a/mythtv/external/FFmpeg/libavformat/mpegts-mythtv.c 
index 4a74c5c3ac..90229cf6ae 100644
--- a/mythtv/external/FFmpeg/libavformat/mpegts-mythtv.c
+++ b/mythtv/external/FFmpeg/libavformat/mpegts-mythtv.c
@@ -2494,12 +2494,17 @@ static SectionContext 
*add_section_stream(MpegTSContext *ts, int pid, int stream
      MpegTSFilter *tss = ts->pids[pid];
      SectionContext *sect = 0;
      if (tss) { /* filter already exists */
+#if 0
+returning the preexisting SectionContext causes it to be double freed 
when its
+owning AVStream is freed.  (It gets freed via AVStream.priv_data.)
          if (tss->type == MPEGTS_SECTION)
              sect = (SectionContext*) tss->u.section_filter.opaque;

          if (sect && (sect->stream_type == stream_type))
              return sect; /* if it's the same stream type, just return 
ok */
          /* otherwise, kill it, and start a new stream */
          mpegts_close_filter(ts, tss);




More information about the mythtv-dev mailing list