Commit cccdd7e3 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: adaptative: don't flag eof if still demuxed data in buffer

parent 458adc37
...@@ -180,14 +180,19 @@ Stream::status Stream::demux(HTTPConnectionManager *connManager, mtime_t nz_dead ...@@ -180,14 +180,19 @@ Stream::status Stream::demux(HTTPConnectionManager *connManager, mtime_t nz_dead
{ {
/* need to read, demuxer still buffering, ... */ /* need to read, demuxer still buffering, ... */
if(read(connManager) <= 0) if(read(connManager) <= 0)
return Stream::status_eof; {
if(output->isEmpty())
if(nz_deadline + VLC_TS_0 > output->getPCR()) /* need to read more */ return Stream::status_eof;
}
else if(nz_deadline + VLC_TS_0 > output->getPCR()) /* need to read more */
{
return Stream::status_buffering; return Stream::status_buffering;
}
} }
if(send) if(send)
output->sendToDecoder(nz_deadline); output->sendToDecoder(nz_deadline);
return Stream::status_demuxed; return Stream::status_demuxed;
} }
...@@ -487,6 +492,19 @@ bool BaseStreamOutput::isSelected() const ...@@ -487,6 +492,19 @@ bool BaseStreamOutput::isSelected() const
return b_selected; return b_selected;
} }
bool BaseStreamOutput::isEmpty() const
{
bool b_empty = true;
vlc_mutex_lock(const_cast<vlc_mutex_t *>(&lock));
std::list<Demuxed *>::const_iterator it;
for(it=queues.begin(); it!=queues.end() && b_empty; ++it)
{
b_empty = !(*it)->p_queue;
}
vlc_mutex_unlock(const_cast<vlc_mutex_t *>(&lock));
return b_empty;
}
void BaseStreamOutput::sendToDecoder(mtime_t nzdeadline) void BaseStreamOutput::sendToDecoder(mtime_t nzdeadline)
{ {
vlc_mutex_lock(&lock); vlc_mutex_lock(&lock);
......
...@@ -114,6 +114,7 @@ namespace adaptative ...@@ -114,6 +114,7 @@ namespace adaptative
virtual bool seekAble() const = 0; virtual bool seekAble() const = 0;
virtual void setPosition(mtime_t) = 0; virtual void setPosition(mtime_t) = 0;
virtual void sendToDecoder(mtime_t) = 0; virtual void sendToDecoder(mtime_t) = 0;
virtual bool isEmpty() const = 0;
virtual bool reinitsOnSeek() const = 0; virtual bool reinitsOnSeek() const = 0;
virtual bool switchAllowed() const = 0; virtual bool switchAllowed() const = 0;
virtual bool isSelected() const = 0; virtual bool isSelected() const = 0;
...@@ -145,6 +146,7 @@ namespace adaptative ...@@ -145,6 +146,7 @@ namespace adaptative
virtual bool seekAble() const; /* reimpl */ virtual bool seekAble() const; /* reimpl */
virtual void setPosition(mtime_t); /* reimpl */ virtual void setPosition(mtime_t); /* reimpl */
virtual void sendToDecoder(mtime_t); /* reimpl */ virtual void sendToDecoder(mtime_t); /* reimpl */
virtual bool isEmpty() const; /* reimpl */
virtual bool reinitsOnSeek() const; /* reimpl */ virtual bool reinitsOnSeek() const; /* reimpl */
virtual bool switchAllowed() const; /* reimpl */ virtual bool switchAllowed() const; /* reimpl */
virtual bool isSelected() const; /* reimpl */ virtual bool isSelected() const; /* reimpl */
......
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