[vlc-devel] [PATCH 1/5] sout: add proper accessor for pace control

RĂ©mi Denis-Courmont remi at remlab.net
Sun Mar 1 13:11:55 CET 2020


This should fix memory races. Switching pace control on or off is still
racy, but that does not seem to be fixable with the current design.
---
 src/stream_output/stream_output.c | 10 ++++++++++
 src/stream_output/stream_output.h |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c
index e8625206a0..dd83aef1c4 100644
--- a/src/stream_output/stream_output.c
+++ b/src/stream_output/stream_output.c
@@ -150,6 +150,16 @@ void sout_DeleteInstance( sout_instance_t * p_sout )
     vlc_object_delete(p_sout);
 }
 
+bool sout_instance_ControlsPace( sout_instance_t *sout )
+{
+    bool ret;
+
+    vlc_mutex_lock( &sout->lock );
+    ret = sout->i_out_pace_nocontrol <= 0;
+    vlc_mutex_unlock( &sout->lock );
+    return ret;
+}
+
 /*****************************************************************************
  * Packetizer/Input
  *****************************************************************************/
diff --git a/src/stream_output/stream_output.h b/src/stream_output/stream_output.h
index 84e5426ded..5a3ddb5cd1 100644
--- a/src/stream_output/stream_output.h
+++ b/src/stream_output/stream_output.h
@@ -44,6 +44,8 @@ sout_instance_t *sout_NewInstance( vlc_object_t *, const char * );
 #define sout_NewInstance(a,b) sout_NewInstance(VLC_OBJECT(a),b)
 void sout_DeleteInstance( sout_instance_t * );
 
+bool sout_instance_ControlsPace( sout_instance_t *sout );
+
 sout_packetizer_input_t *sout_InputNew( sout_instance_t *, const es_format_t * );
 int sout_InputDelete( sout_packetizer_input_t * );
 int sout_InputSendBuffer( sout_packetizer_input_t *, block_t* );
-- 
2.20.1



More information about the vlc-devel mailing list