Commit 3dc73d5d authored by Francois Cartegnie's avatar Francois Cartegnie

demux: adaptative: always set first pcr to lowest dts

parent 2a18a3bf
......@@ -111,7 +111,7 @@ bool PlaylistManager::start(demux_t *demux)
return true;
}
Stream::status PlaylistManager::demux(mtime_t nzdeadline)
Stream::status PlaylistManager::demux(mtime_t nzdeadline, bool send)
{
Stream::status i_return = Stream::status_eof;
......@@ -121,7 +121,7 @@ Stream::status PlaylistManager::demux(mtime_t nzdeadline)
continue;
Stream::status i_ret =
streams[type]->demux(conManager, nzdeadline);
streams[type]->demux(conManager, nzdeadline, send);
if(i_ret == Stream::status_buffering)
{
......
......@@ -52,7 +52,7 @@ namespace adaptative
bool start(demux_t *);
Stream::status demux(mtime_t);
Stream::status demux(mtime_t, bool);
mtime_t getDuration() const;
mtime_t getPCR() const;
mtime_t getFirstDTS() const;
......
......@@ -143,7 +143,7 @@ bool Stream::seekAble() const
return (output && output->seekAble());
}
Stream::status Stream::demux(HTTPConnectionManager *connManager, mtime_t nz_deadline)
Stream::status Stream::demux(HTTPConnectionManager *connManager, mtime_t nz_deadline, bool send)
{
if(nz_deadline + VLC_TS_0 > output->getPCR()) /* not already demuxed */
{
......@@ -155,6 +155,7 @@ Stream::status Stream::demux(HTTPConnectionManager *connManager, mtime_t nz_dead
return Stream::status_buffering;
}
if(send)
output->sendToDecoder(nz_deadline);
return Stream::status_demuxed;
}
......
......@@ -70,7 +70,7 @@ namespace adaptative
int esCount() const;
bool seekAble() const;
typedef enum {status_eof, status_buffering, status_demuxed} status;
status demux(HTTPConnectionManager *, mtime_t);
status demux(HTTPConnectionManager *, mtime_t, bool);
bool setPosition(mtime_t, bool);
mtime_t getPosition() const;
void prune();
......
......@@ -182,8 +182,19 @@ static int Demux(demux_t *p_demux)
{
demux_sys_t *p_sys = p_demux->p_sys;
if(p_sys->i_nzpcr == VLC_TS_INVALID)
{
if( Stream::status_eof ==
p_sys->p_dashManager->demux(p_sys->i_nzpcr + DEMUX_INCREMENT, false) )
{
return VLC_DEMUXER_EOF;
}
mtime_t i_dts = p_sys->p_dashManager->getFirstDTS();
p_sys->i_nzpcr = i_dts;
}
Stream::status status =
p_sys->p_dashManager->demux(p_sys->i_nzpcr + DEMUX_INCREMENT);
p_sys->p_dashManager->demux(p_sys->i_nzpcr + DEMUX_INCREMENT, true);
switch(status)
{
case Stream::status_eof:
......@@ -191,12 +202,12 @@ static int Demux(demux_t *p_demux)
case Stream::status_buffering:
break;
case Stream::status_demuxed:
if(p_sys->i_nzpcr == VLC_TS_INVALID)
p_sys->i_nzpcr = p_sys->p_dashManager->getPCR();
else
if( p_sys->i_nzpcr != VLC_TS_INVALID )
{
p_sys->i_nzpcr += DEMUX_INCREMENT;
int group = p_sys->p_dashManager->getGroup();
es_out_Control(p_demux->out, ES_OUT_SET_GROUP_PCR, group, VLC_TS_0 + p_sys->i_nzpcr);
}
break;
}
......
......@@ -218,8 +218,19 @@ static int Demux(demux_t *p_demux)
{
demux_sys_t *p_sys = p_demux->p_sys;
if(p_sys->i_nzpcr == VLC_TS_INVALID)
{
if( Stream::status_eof ==
p_sys->p_manager->demux(p_sys->i_nzpcr + DEMUX_INCREMENT, false) )
{
return VLC_DEMUXER_EOF;
}
mtime_t i_dts = p_sys->p_manager->getFirstDTS();
p_sys->i_nzpcr = i_dts;
}
Stream::status status =
p_sys->p_manager->demux(p_sys->i_nzpcr + DEMUX_INCREMENT);
p_sys->p_manager->demux(p_sys->i_nzpcr + DEMUX_INCREMENT, true);
switch(status)
{
case Stream::status_eof:
......@@ -227,12 +238,12 @@ static int Demux(demux_t *p_demux)
case Stream::status_buffering:
break;
case Stream::status_demuxed:
if(p_sys->i_nzpcr == VLC_TS_INVALID)
p_sys->i_nzpcr = p_sys->p_manager->getPCR();
else
if( p_sys->i_nzpcr != VLC_TS_INVALID )
{
p_sys->i_nzpcr += DEMUX_INCREMENT;
int group = p_sys->p_manager->getGroup();
es_out_Control(p_demux->out, ES_OUT_SET_GROUP_PCR, group, VLC_TS_0 + p_sys->i_nzpcr);
}
break;
}
......
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