[vlc-commits] sout: add proper accessor for pace control

Rémi Denis-Courmont git at videolan.org
Sun Mar 1 14:35:38 CET 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Mar  1 13:22:47 2020 +0200| [09783bc43dc37c764b8859a8bf07382dd13ccc1f] | committer: Rémi Denis-Courmont

sout: add proper accessor for pace control

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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=09783bc43dc37c764b8859a8bf07382dd13ccc1f
---

 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 239a81936d..6a85878344 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* );



More information about the vlc-commits mailing list