[vlc-commits] [Git][videolan/vlc][master] sout: rtp_rawvideo: error out instead of asserting
Tristan Matthews (@tmatth)
gitlab at videolan.org
Sat Apr 20 19:00:29 UTC 2024
Tristan Matthews pushed to branch master at VideoLAN / VLC
Commits:
66b62f5c by Tristan Matthews at 2024-04-20T14:38:36-04:00
sout: rtp_rawvideo: error out instead of asserting
A bogus fmtp probably shouldn't abort the whole process.
- - - - -
3 changed files:
- modules/stream_out/rtp.c
- modules/stream_out/rtp.h
- modules/stream_out/rtpfmt.c
Changes:
=====================================
modules/stream_out/rtp.c
=====================================
@@ -1728,8 +1728,11 @@ static sout_access_out_t *GrabberCreate( sout_stream_t *p_stream )
return p_grab;
}
-void rtp_get_video_geometry( sout_stream_id_sys_t *id, int *width, int *height )
+int rtp_get_video_geometry( sout_stream_id_sys_t *id, int *width, int *height )
{
int ret = sscanf( id->rtp_fmt.fmtp, "%*s width=%d; height=%d; ", width, height );
- assert( ret == 2 );
+ if( ret != 2 )
+ return VLC_EGENERIC;
+
+ return VLC_SUCCESS;
}
=====================================
modules/stream_out/rtp.h
=====================================
@@ -87,5 +87,5 @@ int rtp_get_fmt( vlc_object_t *obj, const es_format_t *p_fmt, const char *mux,
rtp_format_t *p_rtp_fmt );
/* Only used by rtp_packetize_rawvideo */
-void rtp_get_video_geometry( sout_stream_id_sys_t *id, int *width, int *height );
+int rtp_get_video_geometry( sout_stream_id_sys_t *id, int *width, int *height );
uint16_t rtp_get_extended_sequence( sout_stream_id_sys_t *id );
=====================================
modules/stream_out/rtpfmt.c
=====================================
@@ -1744,7 +1744,12 @@ static int rtp_packetize_vp8( sout_stream_id_sys_t *id, block_t *in )
static int rtp_packetize_rawvideo( sout_stream_id_sys_t *id, block_t *in, vlc_fourcc_t i_format )
{
int i_width, i_height;
- rtp_get_video_geometry( id, &i_width, &i_height );
+ if( rtp_get_video_geometry( id, &i_width, &i_height ) != VLC_SUCCESS )
+ {
+ block_Release( in );
+ return VLC_EGENERIC;
+ }
+
int i_pgroup; /* Size of a group of pixels */
int i_xdec, i_ydec; /* sub-sampling factor in x and y */
switch( i_format )
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/66b62f5c1461735ce948aec25378c8ce8a42c852
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/66b62f5c1461735ce948aec25378c8ce8a42c852
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list