Commit eb3cd5c8 authored by Thomas Guillem's avatar Thomas Guillem

chromecast: yield input_thread while waiting for the CC

parent 496d1a5a
......@@ -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);
......
......@@ -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);
......
......@@ -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)
......
......@@ -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 )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment