Commit a8b9dc7f authored by Zhao Zhili's avatar Zhao Zhili Committed by François Cartegnie

demux: adaptive: fix misordered output

For packets like this:
A1, A2, B1, B2, A3...
which B1 has invalid timestamp and B2 has timestamp < barrier, B2 will
output but B1 is not, so misordered. A packet with invalid timestamp
should not output only if a packet with the same ES id has showed before
and timestamp larget than the barrier.
Signed-off-by: François Cartegnie's avatarFrancois Cartegnie <fcvlcdev@free.fr>
parent aad18acf
......@@ -280,7 +280,7 @@ const CommandsFactory * CommandsQueue::factory() const
mtime_t CommandsQueue::Process( es_out_t *out, mtime_t barrier )
{
mtime_t lastdts = barrier;
std::set<const void *> allowinvalid;
std::set<const void *> disabled_esids;
bool b_datasent = false;
/* We need to filter the current commands list
......@@ -324,22 +324,18 @@ mtime_t CommandsQueue::Process( es_out_t *out, mtime_t barrier )
{
/* ensure no more non dated for that ES is sent
* since we're sure that data is above barrier */
allowinvalid.erase( id );
disabled_esids.insert( id );
commands.push_back( command );
}
else if( command->getTime() == VLC_TS_INVALID )
{
/* Did we sent data already for that ES ? */
if( allowinvalid.find( id ) != allowinvalid.end() ||
/* but also include invalid ones at start (other we will never dequeue them) */
(commands.empty() && output.empty()) )
if( disabled_esids.find( id ) == disabled_esids.end() )
output.push_back( command );
else
commands.push_back( command );
}
else /* Falls below barrier, send */
{
allowinvalid.insert( id );
output.push_back( command );
}
}
......
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