[FFmpeg-devel] [FFmpeg-cvslog] avformat/mpegts: add option max_packet_size

Gyan Doshi ffmpeg at gyani.pro
Sat Feb 5 15:24:35 EET 2022



On 2022-02-02 10:54 am, Gyan Doshi wrote:
>
>
> On 2022-02-02 12:42 am, James Almer wrote:
>>
>>
>> On 2/1/2022 3:47 PM, Michael Niedermayer wrote:
>>> On Sun, Jan 16, 2022 at 05:19:15AM +0000, Gyan Doshi wrote:
>>>> ffmpeg | branch: master | Gyan Doshi <ffmpeg at gyani.pro> | Wed Jan 
>>>> 12 20:57:59 2022 +0530| [bca30570d28bbaa07badadabf55ec3589201a82f] 
>>>> | committer: Gyan Doshi
>>>>
>>>> avformat/mpegts: add option max_packet_size
>>>>
>>>> Makes maximum size of emitted packet user-tunable.
>>>>
>>>> Default is existing 204800 bytes.
>>>>
>>>>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bca30570d28bbaa07badadabf55ec3589201a82f 
>>>>>
>>>> ---
>>>>
>>>>   doc/demuxers.texi    |  4 ++++
>>>>   libavformat/mpegts.c | 11 ++++++-----
>>>>   2 files changed, 10 insertions(+), 5 deletions(-)
>>>
>>> Since this commit there is occasional memory corruption occuring
>>>
>>>    libavutil      57. 18.100 / 57. 18.100
>>>    libavcodec     59. 20.100 / 59. 20.100
>>>    libavformat    59. 17.101 / 59. 17.101
>>>    libavdevice    59.  5.100 / 59.  5.100
>>>    libavfilter     8. 25.100 /  8. 25.100
>>>    libswscale      6.  5.100 /  6.  5.100
>>>    libswresample   4.  4.100 /  4.  4.100
>>>    libpostproc    56.  4.100 / 56.  4.100
>>> invalid fastbin entry (free)
>>> doom/rtp-video: line 14: 15621 Aborted                 (core dumped) 
>>> ./ffmpeg_g -bitexact -protocol_whitelist http,tcp,rtp,udp -i 
>>> http://127.0.0.1:8080/test.sdp -bitexact -acodec mp2 -ab 64k -y -t 1 
>>> -threads 1 $TMP/out.avi
>>> Command exited with non-zero status 134
>>
>> Is the demuxer used in this scenario mpegts or mpegtsraw? The new 
>> option was added to the former but not the latter, yet if both read 
>> MpegTSContext.max_packet_size, for mpegtsraw it will always be 0.
>>
>> The option might need to be added to that demuxer too.
>
> The init appears to be via  avpriv_mpegts_parse_open in mpegts.c
>
> which has this note above,
>
>     /* parsing functions - called from other demuxers such as RTP */
>
> and in it, a few of the context fields are manually initialized. I 
> suspect hardcoding a value here may be enough.

Looks to be enough. Sent patch "avformat/mpegts: initialize 
max_packet_size when sub-demuxer"  to address this.

Regards,
Gyan


More information about the ffmpeg-devel mailing list