Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Steve Lhomme
VLC
Commits
62cbf970
Commit
62cbf970
authored
Nov 07, 2015
by
François Cartegnie
🤞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: add switch event
parent
24b586c7
Changes
3
Show 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
Curren
tRepresentation
(
adaptationSet
);
rep
=
logic
->
get
Nex
tRepresentation
(
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
(
SegmentTracker
ListenerInterface
::
notifications
type
,
ISegment
*
segm
ent
)
void
SegmentTracker
::
notify
(
const
SegmentTracker
Event
&
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
{
struct
{
ISegment
*
s
;
}
discontinuity
;
struct
{
NOTIFICATION_DISCONTINUITY
=
0
BaseRepresentation
*
prev
;
BaseRepresentation
*
next
;
}
switching
;
}
u
;
};
virtual
void
trackerNotification
(
notifications
,
ISegment
*
)
=
0
;
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
(
SegmentTracker
ListenerInterface
::
notifications
,
ISegment
*
);
void
notify
(
const
SegmentTracker
Event
&
);
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