[vlc-devel] [RFC PATCH 1/9] es_out: assert that demux ids are coherent
Thomas Guillem
thomas at gllm.fr
Wed Feb 12 15:43:19 CET 2020
---
src/input/es_out.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 9407c2377bf..fb1a196a2fc 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -176,6 +176,9 @@ typedef struct
/* all es */
int i_id;
+#ifndef NDEBUG
+ int i_auto_id;
+#endif
struct vlc_list es;
struct vlc_list es_slaves; /* Dynamically created es on regular es selection */
@@ -1893,6 +1896,19 @@ static es_out_id_t *EsOutAddSlaveLocked( es_out_t *out, const es_format_t *fmt,
free( es );
return NULL;
}
+
+#ifndef NDEBUG
+ /* Make sure that demux modules send coherent fmt.i_ids. Demux modules
+ * should only send one type of ids: automatic (-1) or valid (>=0).
+ * Otherwise, this can lead to i_id collision */
+ if( p_sys->i_auto_id == 0 )
+ p_sys->i_auto_id = es->fmt.i_id < 0 ? 1 : 2;
+ if( es->fmt.i_id < 0 )
+ assert( p_sys->i_auto_id == 1 );
+ else
+ assert( p_sys->i_auto_id == 2 );
+#endif
+
if( es->fmt.i_id < 0 )
es->fmt.i_id = p_sys->i_id;
if( !es->fmt.i_original_fourcc )
--
2.20.1
More information about the vlc-devel
mailing list