[FFmpeg-devel] [FFmpeg-cvslog] avformat/rtp: Pass sources and block filter addresses via sdp file for rtp

Marton Balint cus at passwd.hu
Sun Apr 5 12:21:28 EEST 2020



On Sun, 5 Apr 2020, Andreas Rheinhardt wrote:

> Carl Eugen Hoyos:
>> Am Mo., 30. März 2020 um 15:38 Uhr schrieb Carl Eugen Hoyos
>> <ceffmpeg at gmail.com>:
>>>
>>> Am Fr., 27. März 2020 um 19:00 Uhr schrieb phunkyfish <git at videolan.org>:
>>>>
>>>> ffmpeg | branch: master | phunkyfish <phunkyfish at gmail.com> | Mon Mar  2 19:21:09 2020 +0000| [b71685865fe761925feedda3cd0b288224d9a509] | committer: Aman Gupta
>>>>
>>>> avformat/rtp: Pass sources and block filter addresses via sdp file for rtp
>>>>
>>>> Signed-off-by: Aman Gupta <aman at tmm1.net>
>>>>
>>>>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b71685865fe761925feedda3cd0b288224d9a509
>>>> ---
>>>>
>>>>  libavformat/rtsp.c | 49 ++++++++++++++++++++++++++++++++++++++++---------
>>>>  1 file changed, 40 insertions(+), 9 deletions(-)
>>>>
>>>> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
>>>> index cd6fc32a29..a69484d78b 100644
>>>> --- a/libavformat/rtsp.c
>>>> +++ b/libavformat/rtsp.c
>>>> @@ -2447,8 +2447,8 @@ static int rtp_probe(const AVProbeData *p)
>>>>  static int rtp_read_header(AVFormatContext *s)
>>>>  {
>>>>      uint8_t recvbuf[RTP_MAX_PACKET_LENGTH];
>>>> -    char host[500], sdp[500];
>>>> -    int ret, port;
>>>> +    char host[500], sdp[1000], filters_buf[1000];
>>>> +    int ret, port, sdp_length, nc;
>>>>      URLContext* in = NULL;
>>>>      int payload_type;
>>>>      AVCodecParameters *par = NULL;
>>>> @@ -2456,6 +2456,7 @@ static int rtp_read_header(AVFormatContext *s)
>>>>      AVIOContext pb;
>>>>      socklen_t addrlen = sizeof(addr);
>>>>      RTSPState *rt = s->priv_data;
>>>> +    const char *p;
>>>>
>>>>      if (!ff_network_init())
>>>>          return AVERROR(EIO);
>>>> @@ -2513,13 +2514,40 @@ static int rtp_read_header(AVFormatContext *s)
>>>>      av_url_split(NULL, 0, NULL, 0, host, sizeof(host), &port,
>>>>                   NULL, 0, s->url);
>>>>
>>>> -    snprintf(sdp, sizeof(sdp),
>>>> -             "v=0\r\nc=IN IP%d %s\r\nm=%s %d RTP/AVP %d\r\n",
>>>> -             addr.ss_family == AF_INET ? 4 : 6, host,
>>>> -             par->codec_type == AVMEDIA_TYPE_DATA  ? "application" :
>>>> -             par->codec_type == AVMEDIA_TYPE_VIDEO ? "video" : "audio",
>>>> -             port, payload_type);
>>>> -    av_log(s, AV_LOG_VERBOSE, "SDP:\n%s\n", sdp);
>>>> +    sdp_length = snprintf(sdp + sdp_length, sizeof(sdp) - sdp_length,
>>>
>>> Could this be reverted, the used variable is not initialized?
>> 
>> I will revert this patch later today if nobody objects.
>> 
> Don't forget to revert this in 4.2, too (yes, it has been backported!).
>
> And mention the weird things surrounding this patch that I mentioned in [1].
>
> - Andreas
>
> [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2020-March/259150.html

And using AVBPrint instead of snprintf would be a lot cleaner anyway.

Regards,
Marton


More information about the ffmpeg-devel mailing list