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
458dc05c
Commit
458dc05c
authored
Sep 17, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: add sequence number to all segments
parent
f5bbc438
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
9 deletions
+27
-9
modules/demux/adaptative/playlist/Segment.cpp
modules/demux/adaptative/playlist/Segment.cpp
+14
-0
modules/demux/adaptative/playlist/Segment.h
modules/demux/adaptative/playlist/Segment.h
+5
-0
modules/demux/hls/playlist/HLSSegment.cpp
modules/demux/hls/playlist/HLSSegment.cpp
+8
-8
modules/demux/hls/playlist/HLSSegment.hpp
modules/demux/hls/playlist/HLSSegment.hpp
+0
-1
No files found.
modules/demux/adaptative/playlist/Segment.cpp
View file @
458dc05c
...
@@ -34,6 +34,9 @@
...
@@ -34,6 +34,9 @@
using
namespace
adaptative
::
http
;
using
namespace
adaptative
::
http
;
using
namespace
adaptative
::
playlist
;
using
namespace
adaptative
::
playlist
;
const
int
ISegment
::
SEQUENCE_INVALID
=
0
;
const
int
ISegment
::
SEQUENCE_FIRST
=
1
;
ISegment
::
ISegment
(
const
ICanonicalUrl
*
parent
)
:
ISegment
::
ISegment
(
const
ICanonicalUrl
*
parent
)
:
ICanonicalUrl
(
parent
),
ICanonicalUrl
(
parent
),
startByte
(
0
),
startByte
(
0
),
...
@@ -44,6 +47,7 @@ ISegment::ISegment(const ICanonicalUrl *parent):
...
@@ -44,6 +47,7 @@ ISegment::ISegment(const ICanonicalUrl *parent):
startTime
.
Set
(
0
);
startTime
.
Set
(
0
);
duration
.
Set
(
0
);
duration
.
Set
(
0
);
chunksuse
.
Set
(
0
);
chunksuse
.
Set
(
0
);
sequence
=
SEQUENCE_INVALID
;
}
}
ISegment
::~
ISegment
()
ISegment
::~
ISegment
()
...
@@ -92,6 +96,16 @@ void ISegment::setByteRange(size_t start, size_t end)
...
@@ -92,6 +96,16 @@ void ISegment::setByteRange(size_t start, size_t end)
endByte
=
end
;
endByte
=
end
;
}
}
void
ISegment
::
setSequenceNumber
(
uint64_t
seq
)
{
sequence
=
SEQUENCE_FIRST
+
seq
;
}
uint64_t
ISegment
::
getSequenceNumber
()
const
{
return
sequence
;
}
size_t
ISegment
::
getOffset
()
const
size_t
ISegment
::
getOffset
()
const
{
{
return
startByte
;
return
startByte
;
...
...
modules/demux/adaptative/playlist/Segment.h
View file @
458dc05c
...
@@ -55,6 +55,8 @@ namespace adaptative
...
@@ -55,6 +55,8 @@ namespace adaptative
*/
*/
virtual
SegmentChunk
*
toChunk
(
size_t
,
BaseRepresentation
*
=
NULL
);
virtual
SegmentChunk
*
toChunk
(
size_t
,
BaseRepresentation
*
=
NULL
);
virtual
void
setByteRange
(
size_t
start
,
size_t
end
);
virtual
void
setByteRange
(
size_t
start
,
size_t
end
);
virtual
void
setSequenceNumber
(
uint64_t
);
virtual
uint64_t
getSequenceNumber
()
const
;
virtual
size_t
getOffset
()
const
;
virtual
size_t
getOffset
()
const
;
virtual
std
::
vector
<
ISegment
*>
subSegments
()
=
0
;
virtual
std
::
vector
<
ISegment
*>
subSegments
()
=
0
;
virtual
void
addSubSegment
(
SubSegment
*
)
=
0
;
virtual
void
addSubSegment
(
SubSegment
*
)
=
0
;
...
@@ -75,6 +77,9 @@ namespace adaptative
...
@@ -75,6 +77,9 @@ namespace adaptative
size_t
endByte
;
size_t
endByte
;
std
::
string
debugName
;
std
::
string
debugName
;
int
classId
;
int
classId
;
uint64_t
sequence
;
static
const
int
SEQUENCE_INVALID
;
static
const
int
SEQUENCE_FIRST
;
virtual
SegmentChunk
*
getChunk
(
const
std
::
string
&
);
virtual
SegmentChunk
*
getChunk
(
const
std
::
string
&
);
};
};
...
...
modules/demux/hls/playlist/HLSSegment.cpp
View file @
458dc05c
...
@@ -38,7 +38,7 @@ SegmentEncryption::SegmentEncryption()
...
@@ -38,7 +38,7 @@ SegmentEncryption::SegmentEncryption()
HLSSegment
::
HLSSegment
(
ICanonicalUrl
*
parent
,
uint64_t
seq
)
:
HLSSegment
::
HLSSegment
(
ICanonicalUrl
*
parent
,
uint64_t
seq
)
:
Segment
(
parent
)
Segment
(
parent
)
{
{
se
quence
=
seq
;
se
tSequenceNumber
(
seq
)
;
#ifdef HAVE_GCRYPT
#ifdef HAVE_GCRYPT
ctx
=
NULL
;
ctx
=
NULL
;
#endif
#endif
...
@@ -85,10 +85,10 @@ void HLSSegment::onChunkDownload(block_t **pp_block, SegmentChunk *chunk, BaseRe
...
@@ -85,10 +85,10 @@ void HLSSegment::onChunkDownload(block_t **pp_block, SegmentChunk *chunk, BaseRe
{
{
encryption
.
iv
.
clear
();
encryption
.
iv
.
clear
();
encryption
.
iv
.
resize
(
16
);
encryption
.
iv
.
resize
(
16
);
encryption
.
iv
[
15
]
=
sequence
&
0xff
;
encryption
.
iv
[
15
]
=
(
getSequenceNumber
()
-
Segment
::
SEQUENCE_FIRST
)
&
0xff
;
encryption
.
iv
[
14
]
=
(
sequence
>>
8
)
&
0xff
;
encryption
.
iv
[
14
]
=
(
(
getSequenceNumber
()
-
Segment
::
SEQUENCE_FIRST
)
>>
8
)
&
0xff
;
encryption
.
iv
[
13
]
=
(
sequence
>>
16
)
&
0xff
;
encryption
.
iv
[
13
]
=
(
(
getSequenceNumber
()
-
Segment
::
SEQUENCE_FIRST
)
>>
16
)
&
0xff
;
encryption
.
iv
[
12
]
=
(
sequence
>>
24
)
&
0xff
;
encryption
.
iv
[
12
]
=
(
(
getSequenceNumber
()
-
Segment
::
SEQUENCE_FIRST
)
>>
24
)
&
0xff
;
}
}
if
(
gcry_cipher_open
(
&
ctx
,
GCRY_CIPHER_AES
,
GCRY_CIPHER_MODE_CBC
,
0
)
||
if
(
gcry_cipher_open
(
&
ctx
,
GCRY_CIPHER_AES
,
GCRY_CIPHER_MODE_CBC
,
0
)
||
...
@@ -148,7 +148,7 @@ void HLSSegment::debug(vlc_object_t *obj, int indent) const
...
@@ -148,7 +148,7 @@ void HLSSegment::debug(vlc_object_t *obj, int indent) const
{
{
std
::
stringstream
ss
;
std
::
stringstream
ss
;
ss
<<
std
::
string
(
indent
,
' '
)
<<
debugName
<<
ss
<<
std
::
string
(
indent
,
' '
)
<<
debugName
<<
" #"
<<
sequence
<<
" #"
<<
(
getSequenceNumber
()
-
Segment
::
SEQUENCE_FIRST
)
<<
" url="
<<
getUrlSegment
().
toString
();
" url="
<<
getUrlSegment
().
toString
();
if
(
startByte
!=
endByte
)
if
(
startByte
!=
endByte
)
ss
<<
" @"
<<
startByte
<<
".."
<<
endByte
;
ss
<<
" @"
<<
startByte
<<
".."
<<
endByte
;
...
@@ -160,9 +160,9 @@ int HLSSegment::compare(ISegment *segment) const
...
@@ -160,9 +160,9 @@ int HLSSegment::compare(ISegment *segment) const
HLSSegment
*
hlssegment
=
dynamic_cast
<
HLSSegment
*>
(
segment
);
HLSSegment
*
hlssegment
=
dynamic_cast
<
HLSSegment
*>
(
segment
);
if
(
hlssegment
)
if
(
hlssegment
)
{
{
if
(
sequence
>
hlssegment
->
sequence
)
if
(
getSequenceNumber
()
>
hlssegment
->
getSequenceNumber
()
)
return
1
;
return
1
;
else
if
(
sequence
<
hlssegment
->
sequence
)
else
if
(
getSequenceNumber
()
<
hlssegment
->
getSequenceNumber
()
)
return
-
1
;
return
-
1
;
else
else
return
0
;
return
0
;
...
...
modules/demux/hls/playlist/HLSSegment.hpp
View file @
458dc05c
...
@@ -63,7 +63,6 @@ namespace hls
...
@@ -63,7 +63,6 @@ namespace hls
virtual
void
onChunkDownload
(
block_t
**
,
SegmentChunk
*
,
BaseRepresentation
*
);
/* reimpl */
virtual
void
onChunkDownload
(
block_t
**
,
SegmentChunk
*
,
BaseRepresentation
*
);
/* reimpl */
void
checkFormat
(
block_t
*
,
SegmentChunk
*
,
BaseRepresentation
*
);
void
checkFormat
(
block_t
*
,
SegmentChunk
*
,
BaseRepresentation
*
);
uint64_t
sequence
;
SegmentEncryption
encryption
;
SegmentEncryption
encryption
;
#ifdef HAVE_GCRYPT
#ifdef HAVE_GCRYPT
gcry_cipher_hd_t
ctx
;
gcry_cipher_hd_t
ctx
;
...
...
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