[vlc-commits] chromecast: yield input_thread while waiting for the CC
Thomas Guillem
git at videolan.org
Wed Feb 7 14:43:18 CET 2018
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Feb 7 11:42:00 2018 +0100| [eb3cd5c8f673e908e9272efa06b5a8d249f53577] | committer: Thomas Guillem
chromecast: yield input_thread while waiting for the CC
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=eb3cd5c8f673e908e9272efa06b5a8d249f53577
---
modules/stream_out/chromecast/chromecast.h | 4 ++--
modules/stream_out/chromecast/chromecast_common.h | 2 +-
modules/stream_out/chromecast/chromecast_ctrl.cpp | 16 ++++++++++------
modules/stream_out/chromecast/chromecast_demux.cpp | 7 ++++++-
4 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/modules/stream_out/chromecast/chromecast.h b/modules/stream_out/chromecast/chromecast.h
index d220171bcc..3a66a0234f 100644
--- a/modules/stream_out/chromecast/chromecast.h
+++ b/modules/stream_out/chromecast/chromecast.h
@@ -176,7 +176,7 @@ struct intf_sys_t
States state() const;
void setPacing(bool do_pace);
- void pace();
+ bool pace();
int httpd_file_fill( uint8_t *psz_request, uint8_t **pp_data, int *pi_data );
void interrupt_wake_up();
@@ -220,7 +220,7 @@ private:
static double get_position(void*);
static void set_initial_time( void*, mtime_t time );
- static void pace(void*);
+ static bool pace(void*);
static void set_on_paused_changed_cb(void *, on_paused_changed_itf, void *);
static void set_pause_state(void*, bool paused);
diff --git a/modules/stream_out/chromecast/chromecast_common.h b/modules/stream_out/chromecast/chromecast_common.h
index 4e47c86f7b..050752fb46 100644
--- a/modules/stream_out/chromecast/chromecast_common.h
+++ b/modules/stream_out/chromecast/chromecast_common.h
@@ -46,7 +46,7 @@ typedef struct
double (*pf_get_position)(void*);
void (*pf_set_initial_time)( void*, mtime_t time );
- void (*pf_pace)(void*);
+ bool (*pf_pace)(void*);
void (*pf_set_pause_state)(void*, bool paused);
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index bc2ac2026e..3762853b0e 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -375,18 +375,22 @@ void intf_sys_t::interrupt_wake_up()
vlc_cond_signal( &m_pace_cond );
}
-void intf_sys_t::pace()
+bool intf_sys_t::pace()
{
vlc_mutex_locker locker(&m_lock);
if( !m_pace )
- return;
+ return true;
m_interrupted = false;
vlc_interrupt_register( interrupt_wake_up_cb, this );
- while( m_pace && !m_interrupted )
- vlc_cond_wait( &m_pace_cond, &m_lock );
+ int ret = 0;
+ mtime_t deadline = mdate() + INT64_C(500000);
+ while( m_pace && !m_interrupted && ret == 0 )
+ ret = vlc_cond_timedwait( &m_pace_cond, &m_lock, deadline );
vlc_interrupt_unregister();
+
+ return ret == 0;
}
/**
@@ -1064,10 +1068,10 @@ void intf_sys_t::set_length(void *pt, mtime_t length)
p_this->m_length = length;
}
-void intf_sys_t::pace(void *pt)
+bool intf_sys_t::pace(void *pt)
{
intf_sys_t *p_this = static_cast<intf_sys_t*>(pt);
- p_this->pace();
+ return p_this->pace();
}
void intf_sys_t::set_pause_state(void *pt, bool paused)
diff --git a/modules/stream_out/chromecast/chromecast_demux.cpp b/modules/stream_out/chromecast/chromecast_demux.cpp
index 9d4380dcb5..173d0b3ffa 100644
--- a/modules/stream_out/chromecast/chromecast_demux.cpp
+++ b/modules/stream_out/chromecast/chromecast_demux.cpp
@@ -170,7 +170,12 @@ struct demux_sys_t
if ( !m_enabled )
return demux_Demux( p_demux->p_next );
- p_renderer->pf_pace( p_renderer->p_opaque );
+ if( !p_renderer->pf_pace( p_renderer->p_opaque ) )
+ {
+ // Still pacing, but we return now in order to let the input thread
+ // do some controls.
+ return VLC_DEMUXER_SUCCESS;
+ }
if( m_startTime == VLC_TS_INVALID )
{
More information about the vlc-commits
mailing list