[FFmpeg-devel] [PATCH 3/3] lavf/sdp: add more thorough error handling

Anton Khirnov anton at khirnov.net
Tue Dec 7 12:20:42 EET 2021


Quoting lance.lmwang at gmail.com (2021-12-05 12:12:54)
> On Sat, Dec 04, 2021 at 06:33:00PM +0100, Anton Khirnov wrote:
> > Return error codes when constructing a stream config fails, rather than
> > just disregarding the failure and continuing.
> > Propagate the error codes from av_sdp_create().
> > ---
> >  libavformat/internal.h |   7 +-
> >  libavformat/sdp.c      | 189 +++++++++++++++++++++++++----------------
> >  2 files changed, 120 insertions(+), 76 deletions(-)
> > 
> > diff --git a/libavformat/internal.h b/libavformat/internal.h
> > index 528ff7e017..db1d83be17 100644
> > --- a/libavformat/internal.h
> > +++ b/libavformat/internal.h
> > @@ -545,10 +545,11 @@ uint64_t ff_parse_ntp_time(uint64_t ntp_ts);
> >   * @param ttl the time to live of the stream, 0 if not multicast
> >   * @param fmt the AVFormatContext, which might contain options modifying
> >   *            the generated SDP
> > + * @return 0 on success, a negative error code on failure
> >   */
> > -void ff_sdp_write_media(char *buff, int size, const AVStream *st, int idx,
> > -                        const char *dest_addr, const char *dest_type,
> > -                        int port, int ttl, AVFormatContext *fmt);
> > +int ff_sdp_write_media(char *buff, int size, const AVStream *st, int idx,
> > +                       const char *dest_addr, const char *dest_type,
> > +                       int port, int ttl, AVFormatContext *fmt);
> >  
> 
> ff_sdp_write_media() is used by movenc.c also, maybe it's better to add the 
> error check there also.

It didn't appear to be completely trivial, so I judged it to be outside
the scope of this patch.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list