Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
62cbf970
Commit
62cbf970
authored
Nov 07, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: add switch event
parent
24b586c7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
16 deletions
+54
-16
modules/demux/adaptative/SegmentTracker.cpp
modules/demux/adaptative/SegmentTracker.cpp
+26
-9
modules/demux/adaptative/SegmentTracker.hpp
modules/demux/adaptative/SegmentTracker.hpp
+27
-7
modules/demux/adaptative/Streams.cpp
modules/demux/adaptative/Streams.cpp
+1
-0
No files found.
modules/demux/adaptative/SegmentTracker.cpp
View file @
62cbf970
...
...
@@ -28,6 +28,19 @@ using namespace adaptative;
using
namespace
adaptative
::
logic
;
using
namespace
adaptative
::
playlist
;
SegmentTrackerEvent
::
SegmentTrackerEvent
(
ISegment
*
s
)
{
type
=
DISCONTINUITY
;
u
.
discontinuity
.
s
=
s
;
}
SegmentTrackerEvent
::
SegmentTrackerEvent
(
BaseRepresentation
*
prev
,
BaseRepresentation
*
next
)
{
type
=
SWITCHING
;
u
.
switching
.
prev
=
prev
;
u
.
switching
.
next
=
next
;
}
SegmentTracker
::
SegmentTracker
(
AbstractAdaptationLogic
*
logic_
,
BaseAdaptationSet
*
adaptSet
)
{
count
=
0
;
...
...
@@ -41,7 +54,7 @@ SegmentTracker::SegmentTracker(AbstractAdaptationLogic *logic_, BaseAdaptationSe
SegmentTracker
::~
SegmentTracker
()
{
reset
();
}
void
SegmentTracker
::
setAdaptationLogic
(
AbstractAdaptationLogic
*
logic_
)
...
...
@@ -49,14 +62,18 @@ void SegmentTracker::setAdaptationLogic(AbstractAdaptationLogic *logic_)
logic
=
logic_
;
}
void
SegmentTracker
::
reset
Counter
()
void
SegmentTracker
::
reset
()
{
notify
(
SegmentTrackerEvent
(
prevRepresentation
,
NULL
));
prevRepresentation
=
NULL
;
init_sent
=
false
;
index_sent
=
false
;
initializing
=
true
;
}
SegmentChunk
*
SegmentTracker
::
getNextChunk
(
bool
switch_allowed
,
HTTPConnectionManager
*
connManager
)
{
BaseRepresentation
*
rep
;
BaseRepresentation
*
rep
=
NULL
;
ISegment
*
segment
;
if
(
!
adaptationSet
)
...
...
@@ -70,13 +87,14 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed, HTTPConnectionM
(
prevRepresentation
&&
prevRepresentation
->
getSwitchPolicy
()
==
SegmentInformation
::
SWITCH_UNAVAILABLE
)
)
rep
=
prevRepresentation
;
else
rep
=
logic
->
get
CurrentRepresentation
(
adaptationSet
);
rep
=
logic
->
get
NextRepresentation
(
adaptationSet
,
prevRepresentation
);
if
(
rep
==
NULL
)
return
NULL
;
if
(
rep
!=
prevRepresentation
)
{
notify
(
SegmentTrackerEvent
(
prevRepresentation
,
rep
));
prevRepresentation
=
rep
;
init_sent
=
false
;
index_sent
=
false
;
...
...
@@ -107,13 +125,12 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed, HTTPConnectionM
segment
=
rep
->
getNextSegment
(
BaseRepresentation
::
INFOTYPE_MEDIA
,
count
,
&
count
,
&
b_gap
);
if
(
b_gap
&&
count
)
{
notify
(
SegmentTrackerListenerInterface
::
notifications
::
NOTIFICATION_DISCONTINUITY
,
segment
);
notify
(
SegmentTrackerEvent
(
segment
));
}
if
(
!
segment
)
{
reset
Counter
();
reset
();
return
NULL
;
}
...
...
@@ -177,9 +194,9 @@ void SegmentTracker::updateSelected()
prevRepresentation
->
runLocalUpdates
(
getSegmentStart
(),
count
);
}
void
SegmentTracker
::
notify
(
SegmentTrackerListenerInterface
::
notifications
type
,
ISegment
*
segm
ent
)
void
SegmentTracker
::
notify
(
const
SegmentTrackerEvent
&
ev
ent
)
{
std
::
list
<
SegmentTrackerListenerInterface
*>::
const_iterator
it
;
for
(
it
=
listeners
.
begin
();
it
!=
listeners
.
end
();
++
it
)
(
*
it
)
->
tracker
Notification
(
type
,
segm
ent
);
(
*
it
)
->
tracker
Event
(
ev
ent
);
}
modules/demux/adaptative/SegmentTracker.hpp
View file @
62cbf970
...
...
@@ -51,14 +51,34 @@ namespace adaptative
using
namespace
logic
;
using
namespace
http
;
class
SegmentTracker
ListenerInterface
class
SegmentTracker
Event
{
public:
enum
notifications
SegmentTrackerEvent
(
ISegment
*
);
SegmentTrackerEvent
(
BaseRepresentation
*
,
BaseRepresentation
*
);
enum
{
DISCONTINUITY
,
SWITCHING
,
}
type
;
union
{
NOTIFICATION_DISCONTINUITY
=
0
};
virtual
void
trackerNotification
(
notifications
,
ISegment
*
)
=
0
;
struct
{
ISegment
*
s
;
}
discontinuity
;
struct
{
BaseRepresentation
*
prev
;
BaseRepresentation
*
next
;
}
switching
;
}
u
;
}
;
class
SegmentTrackerListenerInterface
{
public:
virtual
void
trackerEvent
(
const
SegmentTrackerEvent
&
)
=
0
;
};
class
SegmentTracker
...
...
@@ -68,7 +88,7 @@ namespace adaptative
~
SegmentTracker
();
void
setAdaptationLogic
(
AbstractAdaptationLogic
*
);
void
reset
Counter
();
void
reset
();
SegmentChunk
*
getNextChunk
(
bool
,
HTTPConnectionManager
*
);
bool
setPositionByTime
(
mtime_t
,
bool
,
bool
);
void
setPositionByNumber
(
uint64_t
,
bool
);
...
...
@@ -78,7 +98,7 @@ namespace adaptative
void
updateSelected
();
private:
void
notify
(
SegmentTrackerListenerInterface
::
notifications
,
ISegment
*
);
void
notify
(
const
SegmentTrackerEvent
&
);
bool
initializing
;
bool
index_sent
;
bool
init_sent
;
...
...
modules/demux/adaptative/Streams.cpp
View file @
62cbf970
...
...
@@ -142,6 +142,7 @@ SegmentChunk * AbstractStream::getChunk()
if
(
esCount
()
&&
!
isSelected
())
{
disabled
=
true
;
segmentTracker
->
reset
();
return
NULL
;
}
currentChunk
=
segmentTracker
->
getNextChunk
(
!
fakeesout
->
restarting
(),
connManager
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment