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

Scott Theisen scott.the.elm at gmail.com
Wed Jul 27 01:54:56 UTC 2022


On 7/26/22 18:41, John Pilkington wrote:
> On 26/07/2022 20:09, Scott Theisen wrote:
>> 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 
>> b/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 */
>> -
>> +#endif
>>           /* otherwise, kill it, and start a new stream */
>>           mpegts_close_filter(ts, tss);
>>       }
>>
>> ```
>>
>> Regards,
>>
>> Scott
>
> Attachment is from the unpatched build of ffmpeg-resync.  Will try the 
> rest tomorrow.

 From that log I noticed a minor bug in the codec descriptors location 
and I have added a new commit to my pull requests.  (This only effects 
the logging.  Instead of `unknown_codec` it should say `dsmcc_b` for 
codec 0x17813, AV_CODEC_ID_DSMCC_B.)

I also noticed that it appears to create 5 streams for each of the two 
PIDs for DSMCC streams, but I await the log from master for comparison.

Regards,

Scott


More information about the mythtv-dev mailing list