sout: rtp_rawvideo: error out instead of asserting

A bogus fmtp probably shouldn't abort the whole process.
This commit is contained in:
Tristan Matthews 2024-04-17 13:24:53 -04:00
parent d78eb68e14
commit 66b62f5c14
3 changed files with 12 additions and 4 deletions

View File

@ -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;
}

View File

@ -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 );

View File

@ -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 )