[FFmpeg-devel] [PATCH 1/2] rtsp: pass return code from ffurl_open() on its failure

Andrey Utkin andrey.utkin at corp.bluecherry.net
Thu Oct 23 22:39:21 CEST 2014


On Thu, Oct 23, 2014 at 10:23 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> why doesnt this write into err directly without ret ?

ffurl_open() returns >= 0 in case of success.
Positive value of err can be confusing and can lead to unexpected
behaviour, also at future changes (the modified function is quite
large, so hard for thorough reviewing and accounting of all cases).
So i did it this way to avoid introduction of any side effects.

Even now there's such place (near line 1800):

    if (s->iformat && CONFIG_RTSP_DEMUXER)
        err = ff_rtsp_setup_input_streams(s, reply);
    else if (CONFIG_RTSP_MUXER)
        err = ff_rtsp_setup_output_streams(s, host);
    if (err)
        goto fail;

there's no "just else" clause which sets err, and imagine that err was
set to positive value by ffurl_open() by previous change.
(I have no idea when "if" clause or "else if" clause gets executed in practice.)

-- 
Bluecherry developer.


More information about the ffmpeg-devel mailing list