Commit cccdd7e3 authored by François Cartegnie's avatar François 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
{
/* need to read, demuxer still buffering, ... */
if(read(connManager) <= 0)
return Stream::status_eof;
if(nz_deadline + VLC_TS_0 > output->getPCR()) /* need to read more */
{
if(output->isEmpty())
return Stream::status_eof;
}
else if(nz_deadline + VLC_TS_0 > output->getPCR()) /* need to read more */
{
return Stream::status_buffering;
}
}
if(send)
output->sendToDecoder(nz_deadline);
return Stream::status_demuxed;
}
......@@ -487,6 +492,19 @@ bool BaseStreamOutput::isSelected() const
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)
{
vlc_mutex_lock(&lock);
......
......@@ -114,6 +114,7 @@ namespace adaptative
virtual bool seekAble() const = 0;
virtual void setPosition(mtime_t) = 0;
virtual void sendToDecoder(mtime_t) = 0;
virtual bool isEmpty() const = 0;
virtual bool reinitsOnSeek() const = 0;
virtual bool switchAllowed() const = 0;
virtual bool isSelected() const = 0;
......@@ -145,6 +146,7 @@ namespace adaptative
virtual bool seekAble() const; /* reimpl */
virtual void setPosition(mtime_t); /* reimpl */
virtual void sendToDecoder(mtime_t); /* reimpl */
virtual bool isEmpty() const; /* reimpl */
virtual bool reinitsOnSeek() const; /* reimpl */
virtual bool switchAllowed() 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