Commit 0a6a4489 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: adaptative: ensure data is dropped while restarting

parent 3dc73d5d
...@@ -287,6 +287,7 @@ BaseStreamOutput::BaseStreamOutput(demux_t *demux, const std::string &name) : ...@@ -287,6 +287,7 @@ BaseStreamOutput::BaseStreamOutput(demux_t *demux, const std::string &name) :
seekable = true; seekable = true;
restarting = false; restarting = false;
demuxstream = NULL; demuxstream = NULL;
b_drop = false;
fakeesout = new es_out_t; fakeesout = new es_out_t;
if (!fakeesout) if (!fakeesout)
...@@ -370,12 +371,20 @@ void BaseStreamOutput::setPosition(mtime_t nztime) ...@@ -370,12 +371,20 @@ void BaseStreamOutput::setPosition(mtime_t nztime)
if(pair->p_queue && pair->p_queue->i_dts > VLC_TS_0 + nztime) if(pair->p_queue && pair->p_queue->i_dts > VLC_TS_0 + nztime)
pair->drop(); pair->drop();
} }
/* disable appending until restarted */
b_drop = true;
vlc_mutex_unlock(&lock);
if(reinitsOnSeek())
restart();
vlc_mutex_lock(&lock);
b_drop = false;
pcr = VLC_TS_INVALID; pcr = VLC_TS_INVALID;
vlc_mutex_unlock(&lock); vlc_mutex_unlock(&lock);
es_out_Control(realdemux->out, ES_OUT_SET_NEXT_DISPLAY_TIME, es_out_Control(realdemux->out, ES_OUT_SET_NEXT_DISPLAY_TIME,
VLC_TS_0 + nztime); VLC_TS_0 + nztime);
if(reinitsOnSeek())
restart();
} }
bool BaseStreamOutput::restart() bool BaseStreamOutput::restart()
...@@ -516,6 +525,12 @@ int BaseStreamOutput::esOutSend(es_out_t *fakees, es_out_id_t *p_es, block_t *p_ ...@@ -516,6 +525,12 @@ int BaseStreamOutput::esOutSend(es_out_t *fakees, es_out_id_t *p_es, block_t *p_
{ {
BaseStreamOutput *me = (BaseStreamOutput *) fakees->p_sys; BaseStreamOutput *me = (BaseStreamOutput *) fakees->p_sys;
vlc_mutex_lock(&me->lock); vlc_mutex_lock(&me->lock);
if(me->b_drop)
{
block_ChainRelease( p_block );
}
else
{
std::list<Demuxed *>::const_iterator it; std::list<Demuxed *>::const_iterator it;
for(it=me->queues.begin(); it!=me->queues.end();++it) for(it=me->queues.begin(); it!=me->queues.end();++it)
{ {
...@@ -526,6 +541,7 @@ int BaseStreamOutput::esOutSend(es_out_t *fakees, es_out_id_t *p_es, block_t *p_ ...@@ -526,6 +541,7 @@ int BaseStreamOutput::esOutSend(es_out_t *fakees, es_out_id_t *p_es, block_t *p_
break; break;
} }
} }
}
vlc_mutex_unlock(&me->lock); vlc_mutex_unlock(&me->lock);
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -164,6 +164,7 @@ namespace adaptative ...@@ -164,6 +164,7 @@ namespace adaptative
es_format_t fmtcpy; es_format_t fmtcpy;
}; };
std::list<Demuxed *> queues; std::list<Demuxed *> queues;
bool b_drop;
vlc_mutex_t lock; vlc_mutex_t lock;
void sendToDecoderUnlocked(mtime_t); void sendToDecoderUnlocked(mtime_t);
bool restart(); bool restart();
......
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