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
002015ca
Commit
002015ca
authored
Oct 16, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: simplify using BytesRange
parent
35014185
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
39 deletions
+16
-39
modules/demux/adaptative/Streams.cpp
modules/demux/adaptative/Streams.cpp
+1
-5
modules/demux/adaptative/http/Chunk.cpp
modules/demux/adaptative/http/Chunk.cpp
+7
-22
modules/demux/adaptative/http/Chunk.h
modules/demux/adaptative/http/Chunk.h
+5
-7
modules/demux/adaptative/http/HTTPConnectionManager.cpp
modules/demux/adaptative/http/HTTPConnectionManager.cpp
+1
-1
modules/demux/adaptative/playlist/Segment.cpp
modules/demux/adaptative/playlist/Segment.cpp
+2
-4
No files found.
modules/demux/adaptative/Streams.cpp
View file @
002015ca
...
...
@@ -332,11 +332,7 @@ block_t * AbstractStream::readNextBlock(size_t)
/* New chunk, do query */
if
(
chunk
->
getBytesRead
()
==
0
)
{
BytesRange
bytesRange
;
if
(
chunk
->
usesByteRange
())
bytesRange
=
BytesRange
(
chunk
->
getStartByte
(),
chunk
->
getEndByte
());
if
(
chunk
->
getConnection
()
->
query
(
chunk
->
getPath
(),
bytesRange
)
!=
VLC_SUCCESS
)
if
(
chunk
->
getConnection
()
->
query
(
chunk
->
getPath
(),
chunk
->
getBytesRange
())
!=
VLC_SUCCESS
)
{
currentChunk
=
NULL
;
delete
chunk
;
...
...
modules/demux/adaptative/http/Chunk.cpp
View file @
002015ca
...
...
@@ -33,8 +33,6 @@
using
namespace
adaptative
::
http
;
Chunk
::
Chunk
(
const
std
::
string
&
url
)
:
startByte
(
0
),
endByte
(
0
),
port
(
0
),
length
(
0
),
bytesRead
(
0
),
...
...
@@ -78,34 +76,21 @@ Chunk::~Chunk()
connection
->
setUsed
(
false
);
}
size_t
Chunk
::
getEndByte
()
const
const
BytesRange
&
Chunk
::
getBytesRange
()
const
{
return
endByte
;
}
size_t
Chunk
::
getStartByte
()
const
{
return
startByte
;
return
bytesRange
;
}
const
std
::
string
&
Chunk
::
getUrl
()
const
{
return
url
;
}
void
Chunk
::
setEndByte
(
size_t
endByte
)
{
this
->
endByte
=
endByte
;
if
(
endByte
>
startByte
)
length
=
endByte
-
startByte
;
}
void
Chunk
::
setStartByte
(
size_t
startByte
)
{
this
->
startByte
=
startByte
;
if
(
endByte
>
startByte
)
length
=
endByte
-
startByte
;
}
bool
Chunk
::
usesByteRange
()
const
void
Chunk
::
setBytesRange
(
const
BytesRange
&
range
)
{
return
(
startByte
!=
endByte
);
bytesRange
=
range
;
if
(
bytesRange
.
isValid
()
&&
bytesRange
.
getEndByte
())
length
=
bytesRange
.
getEndByte
()
-
bytesRange
.
getStartByte
();
}
const
std
::
string
&
Chunk
::
getScheme
()
const
...
...
modules/demux/adaptative/http/Chunk.h
View file @
002015ca
...
...
@@ -25,6 +25,7 @@
#ifndef CHUNK_H_
#define CHUNK_H_
#include "BytesRange.hpp"
#include <vector>
#include <string>
#include <stdint.h>
...
...
@@ -43,8 +44,7 @@ namespace adaptative
Chunk
(
const
std
::
string
&
url
);
virtual
~
Chunk
();
size_t
getEndByte
()
const
;
size_t
getStartByte
()
const
;
const
BytesRange
&
getBytesRange
()
const
;
const
std
::
string
&
getUrl
()
const
;
const
std
::
string
&
getScheme
()
const
;
const
std
::
string
&
getHostname
()
const
;
...
...
@@ -57,9 +57,7 @@ namespace adaptative
void
setConnection
(
HTTPConnection
*
connection
);
void
setBytesRead
(
size_t
bytes
);
void
setLength
(
size_t
length
);
void
setEndByte
(
size_t
endByte
);
void
setStartByte
(
size_t
startByte
);
bool
usesByteRange
()
const
;
void
setBytesRange
(
const
BytesRange
&
);
virtual
void
onDownload
(
block_t
**
)
{}
...
...
@@ -68,13 +66,13 @@ namespace adaptative
std
::
string
scheme
;
std
::
string
path
;
std
::
string
hostname
;
size_t
startByte
;
size_t
endByte
;
int
port
;
BytesRange
bytesRange
;
size_t
length
;
size_t
bytesRead
;
HTTPConnection
*
connection
;
};
}
}
...
...
modules/demux/adaptative/http/HTTPConnectionManager.cpp
View file @
002015ca
...
...
@@ -74,7 +74,7 @@ bool HTTPConnectionManager::connectChunk(Chunk *chunk)
return
true
;
msg_Dbg
(
stream
,
"Retrieving %s @%zu"
,
chunk
->
getUrl
().
c_str
(),
chunk
->
get
StartByte
()
);
chunk
->
get
BytesRange
().
isValid
()
?
chunk
->
getBytesRange
().
getStartByte
()
:
0
);
const
int
sockettype
=
(
chunk
->
getScheme
()
==
"https"
)
?
TLSSocket
::
TLS
:
Socket
::
REGULAR
;
HTTPConnection
*
conn
=
getConnection
(
chunk
->
getHostname
(),
chunk
->
getPort
(),
sockettype
);
...
...
modules/demux/adaptative/playlist/Segment.cpp
View file @
002015ca
...
...
@@ -29,6 +29,7 @@
#include "Segment.h"
#include "BaseRepresentation.h"
#include "SegmentChunk.hpp"
#include "../http/BytesRange.hpp"
#include <cassert>
using
namespace
adaptative
::
http
;
...
...
@@ -82,10 +83,7 @@ SegmentChunk* ISegment::toChunk(size_t index, BaseRepresentation *ctxrep)
}
if
(
startByte
!=
endByte
)
{
chunk
->
setStartByte
(
startByte
);
chunk
->
setEndByte
(
endByte
);
}
chunk
->
setBytesRange
(
BytesRange
(
startByte
,
endByte
));
chunk
->
setRepresentation
(
ctxrep
);
...
...
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