[vlc-commits] [Git][videolan/vlc][master] 15 commits: demux: adaptive: force early output of first demuxed times
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Thu Mar 17 06:44:37 UTC 2022
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
e8be1a4e by Francois Cartegnie at 2022-03-16T20:52:37+00:00
demux: adaptive: force early output of first demuxed times
- - - - -
5da424a6 by Francois Cartegnie at 2022-03-16T20:52:37+00:00
demux: adaptive: add buffering media level to command queue
- - - - -
49f71855 by Francois Cartegnie at 2022-03-16T20:52:37+00:00
demux: adaptive: refer to previous segment end time
- - - - -
e136c8ac by Francois Cartegnie at 2022-03-16T20:52:37+00:00
demux: adaptive: reset segment time context on segment gap
- - - - -
235471cf by Francois Cartegnie at 2022-03-16T20:52:37+00:00
demux: adaptive: no buffering on no deadline
- - - - -
b2d6205d by Francois Cartegnie at 2022-03-16T20:52:37+00:00
demux: adaptive: only return bufferized amount past deadline
- - - - -
310f94ef by Francois Cartegnie at 2022-03-16T20:52:37+00:00
demux: adaptive: rewrite media timeline fallback
- - - - -
9819fd9b by Francois Cartegnie at 2022-03-16T20:52:37+00:00
demux: adaptive: call queue to create ES on empty content/subtitles
otherwise it is delayed until first data/pcr
- - - - -
40ea2e85 by Francois Cartegnie at 2022-03-16T20:52:37+00:00
demux: adaptive: use member for isContiguous
- - - - -
dff467b4 by Francois Cartegnie at 2022-03-16T20:52:37+00:00
adaptive: test: add low delay offset check
- - - - -
65d2dccf by Francois Cartegnie at 2022-03-16T20:52:37+00:00
demux: hls: rename error prone method
- - - - -
4aa0143c by Francois Cartegnie at 2022-03-16T20:52:37+00:00
demux: adaptive: use timestamp 0 offset in timestamp mappings
Fixes returning INVALID timestamp when mapping to 0.
- - - - -
f2414d86 by Francois Cartegnie at 2022-03-16T20:52:37+00:00
demux: adaptive: fix init setting expected timestamp for non sms
- - - - -
8f8ea977 by Francois Cartegnie at 2022-03-16T20:52:37+00:00
demux: adaptive: ensure es is created in test
- - - - -
fafd64e0 by Francois Cartegnie at 2022-03-16T20:52:37+00:00
demux: adaptive: properly prune relative segmentlist
- - - - -
12 changed files:
- modules/demux/adaptive/PlaylistManager.cpp
- modules/demux/adaptive/Streams.cpp
- modules/demux/adaptive/Streams.hpp
- modules/demux/adaptive/playlist/SegmentList.cpp
- modules/demux/adaptive/plumbing/CommandsQueue.cpp
- modules/demux/adaptive/plumbing/CommandsQueue.hpp
- modules/demux/adaptive/plumbing/FakeESOut.cpp
- modules/demux/adaptive/plumbing/FakeESOut.hpp
- modules/demux/adaptive/test/playlist/M3U8.cpp
- modules/demux/adaptive/test/plumbing/FakeEsOut.cpp
- modules/demux/hls/HLSStreams.cpp
- modules/demux/hls/HLSStreams.hpp
Changes:
=====================================
modules/demux/adaptive/PlaylistManager.cpp
=====================================
@@ -232,10 +232,6 @@ AbstractStream::BufferingStatus PlaylistManager::bufferize(Times deadline,
PrioritizedAbstractStream &p = *it;
p.st = stream;
p.status = p.st->getBufferAndStatus(deadline, i_min_buffering, i_max_buffering, &p.demuxed_amount);
- p.demuxed_amount = p.st->getDemuxedAmount(deadline).continuous;
- vlc_tick_t mediaAmount;
- if(p.st->getMediaAdvanceAmount(&mediaAmount) && mediaAmount > p.demuxed_amount)
- p.demuxed_amount = mediaAmount;
++it;
}
std::sort(prioritized_streams.begin(), prioritized_streams.end(), streamCompare);
=====================================
modules/demux/adaptive/Streams.cpp
=====================================
@@ -47,6 +47,7 @@ AbstractStream::AbstractStream(demux_t * demux_)
eof = false;
valid = true;
disabled = false;
+ contiguous = true;
segmentgap = false;
discontinuity = false;
needrestart = false;
@@ -92,7 +93,8 @@ bool AbstractStream::init(const StreamFormat &format_, SegmentTracker *tracker)
segmentTracker = tracker;
segmentTracker->registerListener(this);
segmentTracker->notifyBufferingState(true);
- fakeesout->setExpectedTimestamp(segmentTracker->getPlaybackTime());
+ if(mightalwaysstartfromzero)
+ fakeesout->setExpectedTimestamp(VLC_TICK_0 + segmentTracker->getPlaybackTime());
declaredCodecs();
return true;
}
@@ -159,10 +161,10 @@ bool AbstractStream::resetForNewPosition(vlc_tick_t seekMediaTime)
fakeEsOut()->commandsQueue()->Abort( true );
startTimeContext = SegmentTimes();
currentTimeContext = SegmentTimes();
- prevTimeContext = SegmentTimes();
+ prevEndTimeContext = SegmentTimes();
currentChunk = getNextChunk();
if(mightalwaysstartfromzero)
- fakeEsOut()->setExpectedTimestamp(seekMediaTime);
+ fakeEsOut()->setExpectedTimestamp(VLC_TICK_0 + seekMediaTime);
if( !restartDemux() )
{
msg_Info(p_realdemux, "Restart demux failed");
@@ -318,11 +320,6 @@ void AbstractStream::setDisabled(bool b)
disabled = b;
}
-bool AbstractStream::isContiguousMux() const
-{
- return true;
-}
-
bool AbstractStream::isValid() const
{
vlc_mutex_locker locker(&lock);
@@ -350,9 +347,16 @@ bool AbstractStream::decodersDrained()
return fakeEsOut()->decodersDrained();
}
-Times AbstractStream::getDemuxedAmount(Times from) const
+vlc_tick_t AbstractStream::getDemuxedAmount(Times from) const
{
- return fakeEsOut()->commandsQueue()->getDemuxedAmount(from);
+ vlc_tick_t i_demuxed = fakeEsOut()->commandsQueue()->getDemuxedAmount(from).continuous;
+ if(contiguous)
+ {
+ vlc_tick_t i_media_demuxed = fakeEsOut()->commandsQueue()->getDemuxedMediaAmount(from).segment.media;
+ if(i_media_demuxed > i_demuxed)
+ i_demuxed = i_media_demuxed;
+ }
+ return i_demuxed;
}
AbstractStream::BufferingStatus
@@ -363,16 +367,7 @@ AbstractStream::getBufferAndStatus(const Times &deadline,
{
if(last_buffer_status == BufferingStatus::End)
return BufferingStatus::End;
- *pi_demuxed = getDemuxedAmount(deadline).continuous;
- bool b_contiguous = isContiguousMux();
-
- if(!b_contiguous &&
- prevTimeContext.media != VLC_TICK_INVALID &&
- deadline.segment.media != VLC_TICK_INVALID)
- {
- if(prevTimeContext.media - deadline.segment.media > *pi_demuxed)
- *pi_demuxed = prevTimeContext.media - deadline.segment.media;
- }
+ *pi_demuxed = getDemuxedAmount(deadline);
if(*pi_demuxed < i_max_buffering) /* need to read more */
{
@@ -437,7 +432,7 @@ AbstractStream::BufferingStatus AbstractStream::doBufferize(Times deadline,
return BufferingStatus::Suspended;
}
- if(!isContiguousMux())
+ if(!contiguous)
{
if(!fakeEsOut()->hasSynchronizationReference())
{
@@ -483,10 +478,12 @@ AbstractStream::BufferingStatus AbstractStream::doBufferize(Times deadline,
}
vlc_tick_t i_demuxed = fakeEsOut()->commandsQueue()->getDemuxedAmount(deadline).continuous;
- if(!isContiguousMux() && prevTimeContext.media != VLC_TICK_INVALID)
+ if(!contiguous && prevEndTimeContext.media != VLC_TICK_INVALID
+ && deadline.segment.media != VLC_TICK_INVALID)
{
- if(prevTimeContext.media - deadline.segment.media > i_demuxed)
- i_demuxed = prevTimeContext.media - deadline.segment.media;
+ vlc_tick_t i_mediaamount = fakeEsOut()->commandsQueue()->getDemuxedMediaAmount(deadline).segment.media;
+ if(i_mediaamount > i_demuxed)
+ i_demuxed = i_mediaamount;
}
segmentTracker->notifyBufferingLevel(i_min_buffering, i_max_buffering, i_demuxed, i_target_buffering);
@@ -538,13 +535,23 @@ AbstractStream::BufferingStatus AbstractStream::doBufferize(Times deadline,
vlc_mutex_unlock(&lock);
return BufferingStatus::End;
}
- i_demuxed = fakeEsOut()->commandsQueue()->getDemuxedAmount(deadline).continuous;
- segmentTracker->notifyBufferingLevel(i_min_buffering, i_max_buffering, i_demuxed, i_target_buffering);
+
+ if(deadline.continuous != VLC_TICK_INVALID)
+ {
+ i_demuxed = fakeEsOut()->commandsQueue()->getDemuxedAmount(deadline).continuous;
+ segmentTracker->notifyBufferingLevel(i_min_buffering, i_max_buffering, i_demuxed, i_target_buffering);
+ }
+ else
+ {
+ /* On initial pass, there's no demux time known, we need to fake it */
+ if(fakeEsOut()->commandsQueue()->getBufferingLevel().continuous != VLC_TICK_INVALID)
+ i_demuxed = i_min_buffering;
+ }
}
vlc_mutex_unlock(&lock);
Times first = fakeEsOut()->commandsQueue()->getFirstTimes();
- if(isContiguousMux() && first.continuous != VLC_TICK_INVALID && first.segment.demux != VLC_TICK_INVALID)
+ if(contiguous && first.continuous != VLC_TICK_INVALID && first.segment.demux != VLC_TICK_INVALID)
segmentTracker->updateSynchronizationReference(currentSequence, first);
if(i_demuxed < i_max_buffering) /* need to read more */
@@ -595,21 +602,16 @@ AbstractStream::Status AbstractStream::dequeue(Times deadline, Times *times)
pcrvalue ? bufferingLevel - pcrvalue : 0,
description.c_str()));
- Times head = fakeEsOut()->commandsQueue()->getFirstTimes();
if(deadline.continuous <= bufferingLevel) /* demuxed */
{
*times = fakeEsOut()->commandsQueue()->Process(deadline);
return Status::Demuxed;
}
- else if(!isContiguousMux() &&
- deadline.continuous != VLC_TICK_INVALID &&
- prevTimeContext.media != VLC_TICK_INVALID &&
- deadline.segment.media < prevTimeContext.media &&
- head.segment.media <= prevTimeContext.media )
+ else if(!contiguous &&
+ fakeEsOut()->commandsQueue()->getDemuxedMediaAmount(deadline).segment.media > 0)
{
*times = deadline;
- times->segment.offsetBy(prevTimeContext.media - times->segment.media);
- times->continuous += (prevTimeContext.media - times->segment.media);
+ fakeEsOut()->commandsQueue()->Process(Times()); /* handle untimed events (es add) */
return Status::Demuxed;
}
@@ -791,6 +793,8 @@ void AbstractStream::trackerEvent(const TrackerEvent &ev)
case TrackerEvent::Type::SegmentGap:
segmentgap = true;
+ prevEndTimeContext = SegmentTimes();
+ currentTimeContext = SegmentTimes(); /* fired before segmentchanged */
break;
case TrackerEvent::Type::FormatChange:
@@ -863,7 +867,9 @@ void AbstractStream::trackerEvent(const TrackerEvent &ev)
{
needrestart = true;
}
- prevTimeContext = currentTimeContext;
+ prevEndTimeContext = currentTimeContext;
+ prevEndTimeContext.offsetBy(currentDuration);
+ fakeEsOut()->setSegmentProgressTimes(prevEndTimeContext);
currentTimeContext.media = event.starttime;
currentTimeContext.display = event.displaytime;
currentSequence = event.sequence;
=====================================
modules/demux/adaptive/Streams.hpp
=====================================
@@ -86,7 +86,7 @@ namespace adaptive
BufferingStatus bufferize(Times, vlc_tick_t, vlc_tick_t,
vlc_tick_t, bool = false);
BufferingStatus getBufferAndStatus(const Times &, vlc_tick_t, vlc_tick_t, vlc_tick_t *);
- Times getDemuxedAmount(Times) const;
+ vlc_tick_t getDemuxedAmount(Times) const;
Status dequeue(Times, Times *);
bool decodersDrained();
@@ -120,11 +120,11 @@ namespace adaptive
es_out_t *, AbstractSourceStream *) const override;
virtual bool startDemux();
virtual bool restartDemux();
- virtual bool isContiguousMux() const;
virtual void prepareRestart(bool = true);
bool resetForNewPosition(vlc_tick_t);
+ bool contiguous;
bool segmentgap;
bool discontinuity;
bool needrestart;
@@ -158,7 +158,7 @@ namespace adaptive
SegmentTimes startTimeContext;
SegmentTimes currentTimeContext;
- SegmentTimes prevTimeContext;
+ SegmentTimes prevEndTimeContext;
vlc_tick_t currentDuration;
uint64_t currentSequence;
=====================================
modules/demux/adaptive/playlist/SegmentList.cpp
=====================================
@@ -32,7 +32,6 @@
#include <limits>
#include <cassert>
-#include <algorithm>
using namespace adaptive;
using namespace adaptive::playlist;
@@ -117,12 +116,7 @@ void SegmentList::updateWith(AbstractMultipleSegmentBaseType *updated_,
const uint64_t oldest = updated->segments.front()->getSequenceNumber();
/* filter out known segments from the update */
- updated->segments.erase(
- std::remove_if(updated->segments.begin(), updated->segments.end(),
- [updated, prevSegment](Segment *s){
- return s->getSequenceNumber() <= prevSegment->getSequenceNumber();
- }),
- updated->segments.end());
+ updated->pruneBySegmentNumber(prevSegment->getSequenceNumber());
if(updated->segments.empty())
return;
@@ -146,10 +140,7 @@ void SegmentList::updateWith(AbstractMultipleSegmentBaseType *updated_,
updated->segments.clear();
/* prune previous list using update window start */
- segments.erase(std::remove_if(segments.begin(), segments.end(),
- [this, oldest](Segment *s){return s->getSequenceNumber() < oldest;}),
- segments.end());
-
+ pruneBySegmentNumber(oldest);
}
}
=====================================
modules/demux/adaptive/plumbing/CommandsQueue.cpp
=====================================
@@ -40,6 +40,7 @@ enum
ES_OUT_PRIVATE_COMMAND_SEND,
ES_OUT_PRIVATE_COMMAND_DISCONTINUITY,
ES_OUT_PRIVATE_COMMAND_MILESTONE,
+ ES_OUT_PRIVATE_COMMAND_PROGRESS,
};
AbstractCommand::AbstractCommand( int type_ )
@@ -181,6 +182,17 @@ void EsOutMilestoneCommand::Execute()
out->milestoneReached();
}
+EsOutMediaProgressCommand::EsOutMediaProgressCommand(const SegmentTimes &t)
+ : AbstractCommand( ES_OUT_PRIVATE_COMMAND_PROGRESS )
+{
+ times = Times(t, VLC_TICK_INVALID);
+}
+
+void EsOutMediaProgressCommand::Execute()
+{
+
+}
+
/*
* Commands Default Factory
*/
@@ -236,6 +248,13 @@ EsOutMilestoneCommand * CommandsFactory::createEsOutMilestoneCommand( AbstractFa
return new (std::nothrow) EsOutMilestoneCommand( out );
}
+EsOutMediaProgressCommand * CommandsFactory::createEsOutMediaProgressCommand( const SegmentTimes &t ) const
+{
+ try {
+ return new EsOutMediaProgressCommand( t );
+ } catch(...) { return nullptr; }
+}
+
/*
* Commands Queue management
*/
@@ -328,6 +347,12 @@ void CommandsQueue::Schedule( AbstractCommand *command, EsType )
{
delete command;
}
+ else if( command->getType() == ES_OUT_PRIVATE_COMMAND_PROGRESS )
+ {
+ const Times × = command->getTimes();
+ bufferinglevel_media = times.segment;
+ delete command;
+ }
else if( command->getType() == ES_OUT_SET_GROUP_PCR )
{
if(command->getTimes().continuous != VLC_TICK_INVALID)
@@ -458,6 +483,7 @@ void CommandsQueue::Abort( bool b_reset )
if( b_reset )
{
bufferinglevel = Times();
+ bufferinglevel_media = SegmentTimes();
pcr = Times();
b_draining = false;
b_eof = false;
@@ -479,22 +505,24 @@ Times CommandsQueue::getDemuxedAmount(Times from) const
Times bufferingstart = getFirstTimes();
if( bufferinglevel.continuous == VLC_TICK_INVALID ||
bufferingstart.continuous == VLC_TICK_INVALID ||
+ from.continuous == VLC_TICK_INVALID ||
from.continuous > bufferinglevel.continuous )
- return Times(SegmentTimes(0,0),0);
- if( from.continuous > bufferingstart.continuous )
- {
- Times t = bufferinglevel;
- t.segment.offsetBy( -from.continuous );
- t.continuous -= from.continuous;
- return t;
- }
- else
- {
- Times t = bufferinglevel;
- t.segment.offsetBy( -bufferingstart.continuous );
- t.continuous -= bufferingstart.continuous;
- return t;
- }
+ return Times(SegmentTimes(0,0),0); /* durations */
+
+ Times t = bufferinglevel;
+ t.offsetBy( - from.continuous );
+ return t;
+}
+
+Times CommandsQueue::getDemuxedMediaAmount(const Times &from) const
+{
+ if(from.continuous == VLC_TICK_INVALID ||
+ bufferinglevel_media.media == VLC_TICK_INVALID ||
+ from.segment.media > bufferinglevel_media.media)
+ return Times(SegmentTimes(0,0),0); /* durations */
+ Times t = from;
+ t.offsetBy( bufferinglevel_media.media - from.segment.media - from.segment.media );
+ return t;
}
Times CommandsQueue::getBufferingLevel() const
=====================================
modules/demux/adaptive/plumbing/CommandsQueue.hpp
=====================================
@@ -147,6 +147,16 @@ namespace adaptive
AbstractFakeEsOut *out;
};
+ class EsOutMediaProgressCommand : public AbstractCommand
+ {
+ friend class CommandsFactory;
+ public:
+ virtual void Execute() override;
+
+ protected:
+ EsOutMediaProgressCommand( const SegmentTimes & );
+ };
+
/* Factory so we can alter behaviour and filter on execution */
class CommandsFactory
{
@@ -164,6 +174,7 @@ namespace adaptive
virtual EsOutDestroyCommand * createEsOutDestroyCommand() const;
virtual EsOutMetaCommand * createEsOutMetaCommand( AbstractFakeEsOut *, int, const vlc_meta_t * ) const;
virtual EsOutMilestoneCommand * createEsOutMilestoneCommand( AbstractFakeEsOut * ) const;
+ virtual EsOutMediaProgressCommand * createEsOutMediaProgressCommand( const SegmentTimes & ) const;
};
using Queueentry = std::pair<uint64_t, AbstractCommand *>;
@@ -184,6 +195,7 @@ namespace adaptive
bool isDraining() const;
bool isEOF() const;
virtual Times getDemuxedAmount(Times) const = 0;
+ virtual Times getDemuxedMediaAmount(const Times &) const = 0;
virtual Times getBufferingLevel() const = 0;
virtual Times getFirstTimes() const = 0;
virtual Times getPCR() const = 0;
@@ -207,6 +219,7 @@ namespace adaptive
virtual bool isEmpty() const override;
virtual void setDraining() override;
virtual Times getDemuxedAmount(Times) const override;
+ virtual Times getDemuxedMediaAmount(const Times &) const override;
virtual Times getBufferingLevel() const override;
virtual Times getFirstTimes() const override;
virtual Times getPCR() const override;
@@ -216,6 +229,7 @@ namespace adaptive
void LockedSetDraining();
std::list<Queueentry> incoming;
std::list<Queueentry> commands;
+ SegmentTimes bufferinglevel_media;
Times bufferinglevel;
Times pcr;
uint64_t nextsequence;
=====================================
modules/demux/adaptive/plumbing/FakeESOut.cpp
=====================================
@@ -176,14 +176,14 @@ FakeESOut::~FakeESOut()
void FakeESOut::resetTimestamps()
{
- setExpectedTimestamp(-1);
- setAssociatedTimestamp(-1);
+ setExpectedTimestamp(VLC_TICK_INVALID);
+ setAssociatedTimestamp(VLC_TICK_INVALID);
startTimes = SegmentTimes();
}
void FakeESOut::setExpectedTimestamp(vlc_tick_t ts)
{
- if(ts < 0)
+ if(ts == VLC_TICK_INVALID)
{
expected.b_timestamp_set = false;
timestamps_offset = 0;
@@ -198,7 +198,7 @@ void FakeESOut::setExpectedTimestamp(vlc_tick_t ts)
void FakeESOut::setAssociatedTimestamp(vlc_tick_t ts)
{
- if(ts < 0)
+ if(ts == VLC_TICK_INVALID)
{
associated.b_timestamp_set = false;
timestamps_offset = 0;
@@ -213,7 +213,7 @@ void FakeESOut::setAssociatedTimestamp(vlc_tick_t ts)
void FakeESOut::setAssociatedTimestamp(vlc_tick_t mpegts, vlc_tick_t muxed)
{
- if(mpegts < 0)
+ if(mpegts == VLC_TICK_INVALID)
{
setAssociatedTimestamp(mpegts);
}
@@ -360,6 +360,13 @@ void FakeESOut::setSegmentStartTimes(const SegmentTimes &t)
startTimes = t;
}
+void FakeESOut::setSegmentProgressTimes(const SegmentTimes &t)
+{
+ AbstractCommand *c = commandsFactory()->createEsOutMediaProgressCommand(t);
+ if(c)
+ commandsQueue()->Schedule(c);
+}
+
bool FakeESOut::hasSynchronizationReference() const
{
return synchronizationReference.second.continuous != VLC_TICK_INVALID;
=====================================
modules/demux/adaptive/plumbing/FakeESOut.hpp
=====================================
@@ -108,6 +108,7 @@ namespace adaptive
void scheduleNecessaryMilestone();
bool hasSegmentStartTimes() const;
void setSegmentStartTimes(const SegmentTimes &);
+ void setSegmentProgressTimes(const SegmentTimes &);
bool hasSynchronizationReference() const;
void setSynchronizationReference(const SynchronizationReference &);
void schedulePCRReset();
=====================================
modules/demux/adaptive/test/playlist/M3U8.cpp
=====================================
@@ -382,6 +382,41 @@ int M3U8Playlist_test()
return 1;
}
+ /* Manifest 5 */
+ const char manifest5[] =
+ "#EXTM3U\n"
+ "#EXT-X-MEDIA-SEQUENCE:10\n"
+ "#EXTINF:1\n"
+ "foobar.ts\n"
+ "#EXTINF:1\n"
+ "foobar.ts\n"
+ "#EXTINF:1\n"
+ "foobar.ts\n"
+ "#EXTINF:1\n"
+ "foobar.ts\n"
+ "#EXTINF:1\n"
+ "foobar.ts\n";
+
+ m3u = ParseM3U8(obj, manifest5, sizeof(manifest5));
+ try
+ {
+ bufferingLogic = DefaultBufferingLogic();
+ bufferingLogic.setLowDelay(true);
+ Expect(m3u);
+ Expect(m3u->isLive() == true);
+ BaseRepresentation *rep = m3u->getFirstPeriod()->getAdaptationSets().front()->
+ getRepresentations().front();
+ Expect(bufferingLogic.getStartSegmentNumber(rep) ==
+ (UINT64_C(14) - SEC_FROM_VLC_TICK(DefaultBufferingLogic::BUFFERING_LOWEST_LIMIT)));
+
+ delete m3u;
+ }
+ catch (...)
+ {
+ delete m3u;
+ return 1;
+ }
+
return 0;
}
=====================================
modules/demux/adaptive/test/plumbing/FakeEsOut.cpp
=====================================
@@ -214,9 +214,13 @@ static int check1(es_out_t *out, struct context *ctx, FakeESOut *fakees)
es_format_Init(&fmt, VIDEO_ES, VLC_CODEC_H264);
es_out_id_t *id = es_out_Add(out, &fmt);
+ /* ensure ES is created */
+ const Times drainTimes(SegmentTimes(),std::numeric_limits<vlc_tick_t>::max());
+ fakees->commandsQueue()->Commit();
+ fakees->commandsQueue()->Process(drainTimes);
+
try
{
- const Times drainTimes(SegmentTimes(),std::numeric_limits<vlc_tick_t>::max());
vlc_tick_t mediaref = TMS(10000);
SegmentTimes segmentTimes(VLC_TICK_INVALID, mediaref, mediaref);
fakees->setSegmentStartTimes(segmentTimes);
=====================================
modules/demux/hls/HLSStreams.cpp
=====================================
@@ -67,7 +67,7 @@ void HLSStream::setMetadataTimeOffset(vlc_tick_t i_offset)
}
}
-void HLSStream::setMetadataTimeOffset(vlc_tick_t mpegts, vlc_tick_t muxed)
+void HLSStream::setMetadataTimeMapping(vlc_tick_t mpegts, vlc_tick_t muxed)
{
fakeEsOut()->setAssociatedTimestamp(mpegts, muxed);
}
@@ -80,16 +80,23 @@ bool HLSStream::setPosition(const StreamPosition &pos, bool b)
return ok;
}
-bool HLSStream::isContiguousMux() const
+void HLSStream::trackerEvent(const TrackerEvent &e)
{
- if(format == StreamFormat::Type::WebVTT)
- return false;
- if(format == StreamFormat::Type::Unknown)
+ AbstractStream::trackerEvent(e);
+
+ if(e.getType() == TrackerEvent::Type::FormatChange)
{
- const Role r = segmentTracker->getStreamRole();
- return !(r == Role::Value::Caption || r == Role::Value::Subtitle);
+ if(format == StreamFormat::Type::WebVTT)
+ {
+ contiguous = false;
+ }
+ else if(format == StreamFormat::Type::Unknown)
+ {
+ const Role r = segmentTracker->getStreamRole();
+ contiguous = !(r == Role::Value::Caption || r == Role::Value::Subtitle);
+ }
+ else contiguous = true;
}
- return true;
}
int HLSStream::ParseID3PrivTag(const uint8_t *p_payload, size_t i_payload)
@@ -164,7 +171,7 @@ block_t * HLSStream::checkBlock(block_t *p_block, bool b_first)
if(mpegts != std::numeric_limits<uint64_t>::max() &&
local != std::numeric_limits<vlc_tick_t>::max())
{
- setMetadataTimeOffset(mpegts * 100/9, local);
+ setMetadataTimeMapping(VLC_TICK_0 + mpegts * 100/9, VLC_TICK_0 + local);
}
}
}
=====================================
modules/demux/hls/HLSStreams.hpp
=====================================
@@ -37,14 +37,14 @@ namespace hls
virtual AbstractDemuxer * newDemux(vlc_object_t *, const StreamFormat &,
es_out_t *, AbstractSourceStream *) const override;
virtual bool setPosition(const StreamPosition &, bool) override;
- virtual bool isContiguousMux() const override;
+ virtual void trackerEvent(const TrackerEvent &) override;
private:
static int ID3TAG_Parse_Handler(uint32_t, const uint8_t *, size_t, void *);
int ParseID3Tag(uint32_t, const uint8_t *, size_t);
int ParseID3PrivTag(const uint8_t *, size_t);
void setMetadataTimeOffset(vlc_tick_t);
- void setMetadataTimeOffset(vlc_tick_t, vlc_tick_t);
+ void setMetadataTimeMapping(vlc_tick_t, vlc_tick_t);
bool b_id3_timestamps_offset_set;
vlc_meta_t *p_meta;
bool b_meta_updated;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4a44a134ac10a3bf57ae1bd679cad1d0a77f91a7...fafd64e06f5634cc4ee427f99935510032c37fa3
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4a44a134ac10a3bf57ae1bd679cad1d0a77f91a7...fafd64e06f5634cc4ee427f99935510032c37fa3
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list