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
2741ffe6
Commit
2741ffe6
authored
Nov 02, 2015
by
Francois Cartegnie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demux: adaptative: fix splitted bandwidth stats
And avoids creating stats from non http chunks (smooth)
parent
0deb1edc
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
85 additions
and
73 deletions
+85
-73
modules/demux/adaptative/PlaylistManager.cpp
modules/demux/adaptative/PlaylistManager.cpp
+11
-7
modules/demux/adaptative/PlaylistManager.h
modules/demux/adaptative/PlaylistManager.h
+3
-1
modules/demux/adaptative/Streams.cpp
modules/demux/adaptative/Streams.cpp
+3
-11
modules/demux/adaptative/Streams.hpp
modules/demux/adaptative/Streams.hpp
+2
-11
modules/demux/adaptative/http/Chunk.cpp
modules/demux/adaptative/http/Chunk.cpp
+7
-4
modules/demux/adaptative/http/Chunk.h
modules/demux/adaptative/http/Chunk.h
+1
-1
modules/demux/adaptative/http/HTTPConnectionManager.cpp
modules/demux/adaptative/http/HTTPConnectionManager.cpp
+13
-1
modules/demux/adaptative/http/HTTPConnectionManager.h
modules/demux/adaptative/http/HTTPConnectionManager.h
+7
-1
modules/demux/adaptative/logic/IDownloadRateObserver.h
modules/demux/adaptative/logic/IDownloadRateObserver.h
+5
-8
modules/demux/adaptative/tools/Retrieve.cpp
modules/demux/adaptative/tools/Retrieve.cpp
+1
-2
modules/demux/dash/DASHManager.cpp
modules/demux/dash/DASHManager.cpp
+7
-3
modules/demux/dash/DASHManager.h
modules/demux/dash/DASHManager.h
+2
-1
modules/demux/dash/DASHStream.cpp
modules/demux/dash/DASHStream.cpp
+2
-3
modules/demux/dash/DASHStream.hpp
modules/demux/dash/DASHStream.hpp
+1
-2
modules/demux/hls/HLSManager.cpp
modules/demux/hls/HLSManager.cpp
+7
-3
modules/demux/hls/HLSManager.hpp
modules/demux/hls/HLSManager.hpp
+2
-1
modules/demux/hls/HLSStreams.cpp
modules/demux/hls/HLSStreams.cpp
+2
-3
modules/demux/hls/HLSStreams.hpp
modules/demux/hls/HLSStreams.hpp
+1
-2
modules/demux/smooth/SmoothManager.cpp
modules/demux/smooth/SmoothManager.cpp
+3
-2
modules/demux/smooth/SmoothManager.hpp
modules/demux/smooth/SmoothManager.hpp
+2
-1
modules/demux/smooth/SmoothStream.cpp
modules/demux/smooth/SmoothStream.cpp
+2
-3
modules/demux/smooth/SmoothStream.hpp
modules/demux/smooth/SmoothStream.hpp
+1
-2
No files found.
modules/demux/adaptative/PlaylistManager.cpp
View file @
2741ffe6
...
@@ -49,6 +49,7 @@ PlaylistManager::PlaylistManager( demux_t *p_demux_,
...
@@ -49,6 +49,7 @@ PlaylistManager::PlaylistManager( demux_t *p_demux_,
AbstractAdaptationLogic
::
LogicType
type
)
:
AbstractAdaptationLogic
::
LogicType
type
)
:
conManager
(
NULL
),
conManager
(
NULL
),
logicType
(
type
),
logicType
(
type
),
logic
(
NULL
),
playlist
(
pl
),
playlist
(
pl
),
streamFactory
(
factory
),
streamFactory
(
factory
),
p_demux
(
p_demux_
),
p_demux
(
p_demux_
),
...
@@ -79,6 +80,9 @@ bool PlaylistManager::setupPeriod()
...
@@ -79,6 +80,9 @@ bool PlaylistManager::setupPeriod()
if
(
!
currentPeriod
)
if
(
!
currentPeriod
)
return
false
;
return
false
;
if
(
!
logic
&&
!
(
logic
=
createLogic
(
logicType
,
conManager
)))
return
false
;
std
::
vector
<
BaseAdaptationSet
*>
sets
=
currentPeriod
->
getAdaptationSets
();
std
::
vector
<
BaseAdaptationSet
*>
sets
=
currentPeriod
->
getAdaptationSets
();
std
::
vector
<
BaseAdaptationSet
*>::
iterator
it
;
std
::
vector
<
BaseAdaptationSet
*>::
iterator
it
;
for
(
it
=
sets
.
begin
();
it
!=
sets
.
end
();
++
it
)
for
(
it
=
sets
.
begin
();
it
!=
sets
.
end
();
++
it
)
...
@@ -86,10 +90,6 @@ bool PlaylistManager::setupPeriod()
...
@@ -86,10 +90,6 @@ bool PlaylistManager::setupPeriod()
BaseAdaptationSet
*
set
=
*
it
;
BaseAdaptationSet
*
set
=
*
it
;
if
(
set
&&
streamFactory
)
if
(
set
&&
streamFactory
)
{
{
AbstractAdaptationLogic
*
logic
=
createLogic
(
logicType
);
if
(
!
logic
)
continue
;
SegmentTracker
*
tracker
=
new
(
std
::
nothrow
)
SegmentTracker
(
logic
,
set
);
SegmentTracker
*
tracker
=
new
(
std
::
nothrow
)
SegmentTracker
(
logic
,
set
);
if
(
!
tracker
)
if
(
!
tracker
)
{
{
...
@@ -98,7 +98,7 @@ bool PlaylistManager::setupPeriod()
...
@@ -98,7 +98,7 @@ bool PlaylistManager::setupPeriod()
}
}
AbstractStream
*
st
=
streamFactory
->
create
(
p_demux
,
set
->
getStreamFormat
(),
AbstractStream
*
st
=
streamFactory
->
create
(
p_demux
,
set
->
getStreamFormat
(),
logic
,
tracker
,
conManager
);
tracker
,
conManager
);
if
(
!
st
)
if
(
!
st
)
{
{
delete
tracker
;
delete
tracker
;
...
@@ -391,7 +391,7 @@ int PlaylistManager::doControl(int i_query, va_list args)
...
@@ -391,7 +391,7 @@ int PlaylistManager::doControl(int i_query, va_list args)
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
AbstractAdaptationLogic
*
PlaylistManager
::
createLogic
(
AbstractAdaptationLogic
::
LogicType
type
)
AbstractAdaptationLogic
*
PlaylistManager
::
createLogic
(
AbstractAdaptationLogic
::
LogicType
type
,
HTTPConnectionManager
*
conn
)
{
{
switch
(
type
)
switch
(
type
)
{
{
...
@@ -402,7 +402,11 @@ AbstractAdaptationLogic *PlaylistManager::createLogic(AbstractAdaptationLogic::L
...
@@ -402,7 +402,11 @@ AbstractAdaptationLogic *PlaylistManager::createLogic(AbstractAdaptationLogic::L
return
new
(
std
::
nothrow
)
AlwaysLowestAdaptationLogic
();
return
new
(
std
::
nothrow
)
AlwaysLowestAdaptationLogic
();
case
AbstractAdaptationLogic
:
:
Default
:
case
AbstractAdaptationLogic
:
:
Default
:
case
AbstractAdaptationLogic
:
:
RateBased
:
case
AbstractAdaptationLogic
:
:
RateBased
:
return
new
(
std
::
nothrow
)
RateBasedAdaptationLogic
(
0
,
0
);
{
RateBasedAdaptationLogic
*
logic
=
new
(
std
::
nothrow
)
RateBasedAdaptationLogic
(
0
,
0
);
conn
->
setDownloadRateObserver
(
logic
);
return
logic
;
}
default:
default:
return
NULL
;
return
NULL
;
}
}
...
...
modules/demux/adaptative/PlaylistManager.h
View file @
2741ffe6
...
@@ -74,10 +74,12 @@ namespace adaptative
...
@@ -74,10 +74,12 @@ namespace adaptative
bool
setupPeriod
();
bool
setupPeriod
();
void
unsetPeriod
();
void
unsetPeriod
();
/* local factories */
/* local factories */
virtual
AbstractAdaptationLogic
*
createLogic
(
AbstractAdaptationLogic
::
LogicType
);
virtual
AbstractAdaptationLogic
*
createLogic
(
AbstractAdaptationLogic
::
LogicType
,
HTTPConnectionManager
*
);
HTTPConnectionManager
*
conManager
;
HTTPConnectionManager
*
conManager
;
AbstractAdaptationLogic
::
LogicType
logicType
;
AbstractAdaptationLogic
::
LogicType
logicType
;
AbstractAdaptationLogic
*
logic
;
AbstractPlaylist
*
playlist
;
AbstractPlaylist
*
playlist
;
AbstractStreamFactory
*
streamFactory
;
AbstractStreamFactory
*
streamFactory
;
demux_t
*
p_demux
;
demux_t
*
p_demux
;
...
...
modules/demux/adaptative/Streams.cpp
View file @
2741ffe6
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
#include "Streams.hpp"
#include "Streams.hpp"
#include "http/HTTPConnection.hpp"
#include "http/HTTPConnection.hpp"
#include "http/HTTPConnectionManager.h"
#include "http/HTTPConnectionManager.h"
#include "logic/AbstractAdaptationLogic.h"
#include "playlist/SegmentChunk.hpp"
#include "playlist/SegmentChunk.hpp"
#include "SegmentTracker.hpp"
#include "SegmentTracker.hpp"
#include "plumbing/SourceStream.hpp"
#include "plumbing/SourceStream.hpp"
...
@@ -30,13 +29,11 @@
...
@@ -30,13 +29,11 @@
using
namespace
adaptative
;
using
namespace
adaptative
;
using
namespace
adaptative
::
http
;
using
namespace
adaptative
::
http
;
using
namespace
adaptative
::
logic
;
AbstractStream
::
AbstractStream
(
demux_t
*
demux_
,
const
StreamFormat
&
format_
)
AbstractStream
::
AbstractStream
(
demux_t
*
demux_
,
const
StreamFormat
&
format_
)
{
{
p_realdemux
=
demux_
;
p_realdemux
=
demux_
;
format
=
format_
;
format
=
format_
;
adaptationLogic
=
NULL
;
currentChunk
=
NULL
;
currentChunk
=
NULL
;
eof
=
false
;
eof
=
false
;
dead
=
false
;
dead
=
false
;
...
@@ -71,7 +68,6 @@ AbstractStream::AbstractStream(demux_t * demux_, const StreamFormat &format_)
...
@@ -71,7 +68,6 @@ AbstractStream::AbstractStream(demux_t * demux_, const StreamFormat &format_)
AbstractStream
::~
AbstractStream
()
AbstractStream
::~
AbstractStream
()
{
{
delete
currentChunk
;
delete
currentChunk
;
delete
adaptationLogic
;
delete
segmentTracker
;
delete
segmentTracker
;
delete
demuxer
;
delete
demuxer
;
...
@@ -80,10 +76,8 @@ AbstractStream::~AbstractStream()
...
@@ -80,10 +76,8 @@ AbstractStream::~AbstractStream()
}
}
void
AbstractStream
::
bind
(
AbstractAdaptationLogic
*
logic
,
SegmentTracker
*
tracker
,
void
AbstractStream
::
bind
(
SegmentTracker
*
tracker
,
HTTPConnectionManager
*
conn
)
HTTPConnectionManager
*
conn
)
{
{
adaptationLogic
=
logic
;
segmentTracker
=
tracker
;
segmentTracker
=
tracker
;
connManager
=
conn
;
connManager
=
conn
;
}
}
...
@@ -226,7 +220,7 @@ bool AbstractStream::isDisabled() const
...
@@ -226,7 +220,7 @@ bool AbstractStream::isDisabled() const
AbstractStream
::
status
AbstractStream
::
demux
(
mtime_t
nz_deadline
,
bool
send
)
AbstractStream
::
status
AbstractStream
::
demux
(
mtime_t
nz_deadline
,
bool
send
)
{
{
/* Ensure it is configured */
/* Ensure it is configured */
if
(
!
adaptationLogic
||
!
segmentTracker
||
!
connManager
||
dead
)
if
(
!
segmentTracker
||
!
connManager
||
dead
)
return
AbstractStream
::
status_eof
;
return
AbstractStream
::
status_eof
;
if
(
flushing
)
if
(
flushing
)
...
@@ -322,8 +316,7 @@ block_t * AbstractStream::readNextBlock(size_t toread)
...
@@ -322,8 +316,7 @@ block_t * AbstractStream::readNextBlock(size_t toread)
const
bool
b_segment_head_chunk
=
(
chunk
->
getBytesRead
()
==
0
);
const
bool
b_segment_head_chunk
=
(
chunk
->
getBytesRead
()
==
0
);
mtime_t
time
;
block_t
*
block
=
chunk
->
read
(
toread
);
block_t
*
block
=
chunk
->
read
(
toread
,
&
time
);
if
(
block
==
NULL
)
if
(
block
==
NULL
)
{
{
currentChunk
=
NULL
;
currentChunk
=
NULL
;
...
@@ -331,7 +324,6 @@ block_t * AbstractStream::readNextBlock(size_t toread)
...
@@ -331,7 +324,6 @@ block_t * AbstractStream::readNextBlock(size_t toread)
return
NULL
;
return
NULL
;
}
}
adaptationLogic
->
updateDownloadRate
(
block
->
i_buffer
,
time
);
if
(
chunk
->
getBytesToRead
()
==
0
)
if
(
chunk
->
getBytesToRead
()
==
0
)
{
{
currentChunk
=
NULL
;
currentChunk
=
NULL
;
...
...
modules/demux/adaptative/Streams.hpp
View file @
2741ffe6
...
@@ -43,18 +43,12 @@ namespace adaptative
...
@@ -43,18 +43,12 @@ namespace adaptative
class
HTTPConnectionManager
;
class
HTTPConnectionManager
;
}
}
namespace
logic
{
class
AbstractAdaptationLogic
;
}
namespace
playlist
namespace
playlist
{
{
class
SegmentChunk
;
class
SegmentChunk
;
}
}
using
namespace
http
;
using
namespace
http
;
using
namespace
logic
;
using
namespace
playlist
;
using
namespace
playlist
;
class
AbstractStream
:
public
ChunksSource
,
class
AbstractStream
:
public
ChunksSource
,
...
@@ -63,8 +57,7 @@ namespace adaptative
...
@@ -63,8 +57,7 @@ namespace adaptative
public:
public:
AbstractStream
(
demux_t
*
,
const
StreamFormat
&
);
AbstractStream
(
demux_t
*
,
const
StreamFormat
&
);
virtual
~
AbstractStream
();
virtual
~
AbstractStream
();
void
bind
(
AbstractAdaptationLogic
*
,
SegmentTracker
*
,
void
bind
(
SegmentTracker
*
,
HTTPConnectionManager
*
);
HTTPConnectionManager
*
);
void
setLanguage
(
const
std
::
string
&
);
void
setLanguage
(
const
std
::
string
&
);
void
setDescription
(
const
std
::
string
&
);
void
setDescription
(
const
std
::
string
&
);
...
@@ -105,7 +98,6 @@ namespace adaptative
...
@@ -105,7 +98,6 @@ namespace adaptative
demux_t
*
p_realdemux
;
demux_t
*
p_realdemux
;
StreamFormat
format
;
StreamFormat
format
;
AbstractAdaptationLogic
*
adaptationLogic
;
HTTPConnectionManager
*
connManager
;
/* not owned */
HTTPConnectionManager
*
connManager
;
/* not owned */
SegmentTracker
*
segmentTracker
;
SegmentTracker
*
segmentTracker
;
...
@@ -128,8 +120,7 @@ namespace adaptative
...
@@ -128,8 +120,7 @@ namespace adaptative
public:
public:
virtual
~
AbstractStreamFactory
()
{}
virtual
~
AbstractStreamFactory
()
{}
virtual
AbstractStream
*
create
(
demux_t
*
,
const
StreamFormat
&
,
virtual
AbstractStream
*
create
(
demux_t
*
,
const
StreamFormat
&
,
AbstractAdaptationLogic
*
,
SegmentTracker
*
,
SegmentTracker
*
,
HTTPConnectionManager
*
)
const
=
0
;
HTTPConnectionManager
*
)
const
=
0
;
};
};
}
}
#endif // STREAMS_HPP
#endif // STREAMS_HPP
modules/demux/adaptative/http/Chunk.cpp
View file @
2741ffe6
...
@@ -90,15 +90,12 @@ size_t AbstractChunk::getBytesToRead() const
...
@@ -90,15 +90,12 @@ size_t AbstractChunk::getBytesToRead() const
return
source
->
getContentLength
()
-
bytesRead
;
return
source
->
getContentLength
()
-
bytesRead
;
}
}
block_t
*
AbstractChunk
::
read
(
size_t
size
,
mtime_t
*
time
)
block_t
*
AbstractChunk
::
read
(
size_t
size
)
{
{
if
(
!
source
)
if
(
!
source
)
return
NULL
;
return
NULL
;
*
time
=
mdate
();
block_t
*
block
=
source
->
read
(
size
);
block_t
*
block
=
source
->
read
(
size
);
*
time
=
mdate
()
-
*
time
;
if
(
block
)
if
(
block
)
{
{
if
(
bytesRead
==
0
)
if
(
bytesRead
==
0
)
...
@@ -173,7 +170,9 @@ block_t * HTTPChunkSource::consume(size_t readsize)
...
@@ -173,7 +170,9 @@ block_t * HTTPChunkSource::consume(size_t readsize)
if
(
!
p_block
)
if
(
!
p_block
)
return
NULL
;
return
NULL
;
mtime_t
time
=
mdate
();
ssize_t
ret
=
connection
->
read
(
p_block
->
p_buffer
,
readsize
);
ssize_t
ret
=
connection
->
read
(
p_block
->
p_buffer
,
readsize
);
time
=
mdate
()
-
time
;
if
(
ret
<
0
)
if
(
ret
<
0
)
{
{
block_Release
(
p_block
);
block_Release
(
p_block
);
...
@@ -183,6 +182,7 @@ block_t * HTTPChunkSource::consume(size_t readsize)
...
@@ -183,6 +182,7 @@ block_t * HTTPChunkSource::consume(size_t readsize)
{
{
p_block
->
i_buffer
=
(
size_t
)
ret
;
p_block
->
i_buffer
=
(
size_t
)
ret
;
consumed
+=
p_block
->
i_buffer
;
consumed
+=
p_block
->
i_buffer
;
connManager
->
updateDownloadRate
(
p_block
->
i_buffer
,
time
);
}
}
return
p_block
;
return
p_block
;
...
@@ -240,7 +240,9 @@ void HTTPChunkBufferedSource::bufferize(size_t readsize)
...
@@ -240,7 +240,9 @@ void HTTPChunkBufferedSource::bufferize(size_t readsize)
if
(
!
p_block
)
if
(
!
p_block
)
return
;
return
;
mtime_t
time
=
mdate
();
ssize_t
ret
=
connection
->
read
(
p_block
->
p_buffer
,
readsize
);
ssize_t
ret
=
connection
->
read
(
p_block
->
p_buffer
,
readsize
);
time
=
mdate
()
-
time
;
if
(
ret
<
0
)
if
(
ret
<
0
)
{
{
block_Release
(
p_block
);
block_Release
(
p_block
);
...
@@ -250,6 +252,7 @@ void HTTPChunkBufferedSource::bufferize(size_t readsize)
...
@@ -250,6 +252,7 @@ void HTTPChunkBufferedSource::bufferize(size_t readsize)
p_block
->
i_buffer
=
(
size_t
)
ret
;
p_block
->
i_buffer
=
(
size_t
)
ret
;
buffered
+=
p_block
->
i_buffer
;
buffered
+=
p_block
->
i_buffer
;
block_ChainAppend
(
&
p_buffer
,
p_block
);
block_ChainAppend
(
&
p_buffer
,
p_block
);
connManager
->
updateDownloadRate
(
p_block
->
i_buffer
,
time
);
}
}
}
}
...
...
modules/demux/adaptative/http/Chunk.h
View file @
2741ffe6
...
@@ -65,7 +65,7 @@ namespace adaptative
...
@@ -65,7 +65,7 @@ namespace adaptative
size_t
getBytesRead
()
const
;
size_t
getBytesRead
()
const
;
size_t
getBytesToRead
()
const
;
size_t
getBytesToRead
()
const
;
virtual
block_t
*
read
(
size_t
,
mtime_t
*
);
virtual
block_t
*
read
(
size_t
);
virtual
void
onDownload
(
block_t
**
)
=
0
;
virtual
void
onDownload
(
block_t
**
)
=
0
;
protected:
protected:
...
...
modules/demux/adaptative/http/HTTPConnectionManager.cpp
View file @
2741ffe6
...
@@ -33,7 +33,8 @@
...
@@ -33,7 +33,8 @@
using
namespace
adaptative
::
http
;
using
namespace
adaptative
::
http
;
HTTPConnectionManager
::
HTTPConnectionManager
(
vlc_object_t
*
stream
)
:
HTTPConnectionManager
::
HTTPConnectionManager
(
vlc_object_t
*
stream
)
:
stream
(
stream
)
stream
(
stream
),
rateObserver
(
NULL
)
{
{
}
}
HTTPConnectionManager
::~
HTTPConnectionManager
()
HTTPConnectionManager
::~
HTTPConnectionManager
()
...
@@ -100,3 +101,14 @@ HTTPConnection * HTTPConnectionManager::getConnection(const std::string &scheme,
...
@@ -100,3 +101,14 @@ HTTPConnection * HTTPConnectionManager::getConnection(const std::string &scheme,
conn
->
setUsed
(
true
);
conn
->
setUsed
(
true
);
return
conn
;
return
conn
;
}
}
void
HTTPConnectionManager
::
updateDownloadRate
(
size_t
size
,
mtime_t
time
)
{
if
(
rateObserver
)
rateObserver
->
updateDownloadRate
(
size
,
time
);
}
void
HTTPConnectionManager
::
setDownloadRateObserver
(
IDownloadRateObserver
*
obs
)
{
rateObserver
=
obs
;
}
modules/demux/adaptative/http/HTTPConnectionManager.h
View file @
2741ffe6
...
@@ -29,6 +29,8 @@
...
@@ -29,6 +29,8 @@
# include "config.h"
# include "config.h"
#endif
#endif
#include "../logic/IDownloadRateObserver.h"
#include <vlc_common.h>
#include <vlc_common.h>
#include <vector>
#include <vector>
#include <string>
#include <string>
...
@@ -39,7 +41,7 @@ namespace adaptative
...
@@ -39,7 +41,7 @@ namespace adaptative
{
{
class
HTTPConnection
;
class
HTTPConnection
;
class
HTTPConnectionManager
class
HTTPConnectionManager
:
public
IDownloadRateObserver
{
{
public:
public:
HTTPConnectionManager
(
vlc_object_t
*
stream
);
HTTPConnectionManager
(
vlc_object_t
*
stream
);
...
@@ -51,9 +53,13 @@ namespace adaptative
...
@@ -51,9 +53,13 @@ namespace adaptative
const
std
::
string
&
hostname
,
const
std
::
string
&
hostname
,
uint16_t
port
);
uint16_t
port
);
virtual
void
updateDownloadRate
(
size_t
,
mtime_t
);
/* reimpl */
void
setDownloadRateObserver
(
IDownloadRateObserver
*
);
private:
private:
std
::
vector
<
HTTPConnection
*>
connectionPool
;
std
::
vector
<
HTTPConnection
*>
connectionPool
;
vlc_object_t
*
stream
;
vlc_object_t
*
stream
;
IDownloadRateObserver
*
rateObserver
;
HTTPConnection
*
getConnection
(
const
std
::
string
&
hostname
,
uint16_t
port
,
int
);
HTTPConnection
*
getConnection
(
const
std
::
string
&
hostname
,
uint16_t
port
,
int
);
};
};
...
...
modules/demux/adaptative/logic/IDownloadRateObserver.h
View file @
2741ffe6
...
@@ -33,15 +33,12 @@
...
@@ -33,15 +33,12 @@
namespace
adaptative
namespace
adaptative
{
{
namespace
logic
class
IDownloadRateObserver
{
{
class
IDownloadRateObserver
public:
{
virtual
void
updateDownloadRate
(
size_t
,
mtime_t
)
=
0
;
public:
virtual
~
IDownloadRateObserver
(){}
virtual
void
updateDownloadRate
(
size_t
,
mtime_t
)
=
0
;
};
virtual
~
IDownloadRateObserver
(){}
};
}
}
}
#endif
/* IDOWNLOADRATEOBSERVER_H_ */
#endif
/* IDOWNLOADRATEOBSERVER_H_ */
modules/demux/adaptative/tools/Retrieve.cpp
View file @
2741ffe6
...
@@ -37,8 +37,7 @@ block_t * Retrieve::HTTP(vlc_object_t *obj, const std::string &uri)
...
@@ -37,8 +37,7 @@ block_t * Retrieve::HTTP(vlc_object_t *obj, const std::string &uri)
return
NULL
;
return
NULL
;
}
}
mtime_t
time
;
block_t
*
block
=
datachunk
->
read
(
1
<<
21
);
block_t
*
block
=
datachunk
->
read
(
1
<<
21
,
&
time
);
delete
datachunk
;
delete
datachunk
;
return
block
;
return
block
;
}
}
modules/demux/dash/DASHManager.cpp
View file @
2741ffe6
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#include "xml/DOMParser.h"
#include "xml/DOMParser.h"
#include "../adaptative/logic/RateBasedAdaptationLogic.h"
#include "../adaptative/logic/RateBasedAdaptationLogic.h"
#include "../adaptative/tools/Helper.h"
#include "../adaptative/tools/Helper.h"
#include "../adaptative/http/HTTPConnectionManager.h"
#include <vlc_stream.h>
#include <vlc_stream.h>
#include <vlc_demux.h>
#include <vlc_demux.h>
#include <vlc_meta.h>
#include <vlc_meta.h>
...
@@ -200,7 +201,8 @@ bool DASHManager::isDASH(stream_t *stream)
...
@@ -200,7 +201,8 @@ bool DASHManager::isDASH(stream_t *stream)
return
false
;
return
false
;
}
}
AbstractAdaptationLogic
*
DASHManager
::
createLogic
(
AbstractAdaptationLogic
::
LogicType
type
)
AbstractAdaptationLogic
*
DASHManager
::
createLogic
(
AbstractAdaptationLogic
::
LogicType
type
,
HTTPConnectionManager
*
conn
)
{
{
switch
(
type
)
switch
(
type
)
{
{
...
@@ -214,9 +216,11 @@ AbstractAdaptationLogic *DASHManager::createLogic(AbstractAdaptationLogic::Logic
...
@@ -214,9 +216,11 @@ AbstractAdaptationLogic *DASHManager::createLogic(AbstractAdaptationLogic::Logic
{
{
int
width
=
var_InheritInteger
(
p_demux
,
"adaptative-width"
);
int
width
=
var_InheritInteger
(
p_demux
,
"adaptative-width"
);
int
height
=
var_InheritInteger
(
p_demux
,
"adaptative-height"
);
int
height
=
var_InheritInteger
(
p_demux
,
"adaptative-height"
);
return
new
(
std
::
nothrow
)
RateBasedAdaptationLogic
(
width
,
height
);
RateBasedAdaptationLogic
*
logic
=
new
(
std
::
nothrow
)
RateBasedAdaptationLogic
(
width
,
height
);
conn
->
setDownloadRateObserver
(
logic
);
return
logic
;
}
}
default:
default:
return
PlaylistManager
::
createLogic
(
type
);
return
PlaylistManager
::
createLogic
(
type
,
conn
);
}
}
}
}
modules/demux/dash/DASHManager.h
View file @
2741ffe6
...
@@ -42,7 +42,8 @@ namespace dash
...
@@ -42,7 +42,8 @@ namespace dash
virtual
~
DASHManager
();
virtual
~
DASHManager
();
virtual
bool
updatePlaylist
();
//reimpl
virtual
bool
updatePlaylist
();
//reimpl
virtual
AbstractAdaptationLogic
*
createLogic
(
AbstractAdaptationLogic
::
LogicType
);
//reimpl
virtual
AbstractAdaptationLogic
*
createLogic
(
AbstractAdaptationLogic
::
LogicType
,
HTTPConnectionManager
*
);
//reimpl
static
bool
isDASH
(
stream_t
*
);
static
bool
isDASH
(
stream_t
*
);
...
...
modules/demux/dash/DASHStream.cpp
View file @
2741ffe6
...
@@ -69,8 +69,7 @@ AbstractDemuxer * DASHStream::createDemux(const StreamFormat &format)
...
@@ -69,8 +69,7 @@ AbstractDemuxer * DASHStream::createDemux(const StreamFormat &format)
}
}
AbstractStream
*
DASHStreamFactory
::
create
(
demux_t
*
realdemux
,
const
StreamFormat
&
format
,
AbstractStream
*
DASHStreamFactory
::
create
(
demux_t
*
realdemux
,
const
StreamFormat
&
format
,
AbstractAdaptationLogic
*
logic
,
SegmentTracker
*
tracker
,
SegmentTracker
*
tracker
,
HTTPConnectionManager
*
manager
)
const
HTTPConnectionManager
*
manager
)
const
{
{
AbstractStream
*
stream
;
AbstractStream
*
stream
;
try
try
...
@@ -79,6 +78,6 @@ AbstractStream * DASHStreamFactory::create(demux_t *realdemux, const StreamForma
...
@@ -79,6 +78,6 @@ AbstractStream * DASHStreamFactory::create(demux_t *realdemux, const StreamForma
}
catch
(
int
)
{
}
catch
(
int
)
{
return
NULL
;
return
NULL
;
}
}
stream
->
bind
(
logic
,
tracker
,
manager
);
stream
->
bind
(
tracker
,
manager
);
return
stream
;
return
stream
;
}
}
modules/demux/dash/DASHStream.hpp
View file @
2741ffe6
...
@@ -44,8 +44,7 @@ namespace dash
...
@@ -44,8 +44,7 @@ namespace dash
{
{
public:
public:
virtual
AbstractStream
*
create
(
demux_t
*
,
const
StreamFormat
&
,
virtual
AbstractStream
*
create
(
demux_t
*
,
const
StreamFormat
&
,
AbstractAdaptationLogic
*
,
SegmentTracker
*
,
SegmentTracker
*
,
HTTPConnectionManager
*
)
const
;
HTTPConnectionManager
*
)
const
;
};
};
}
}
...
...
modules/demux/hls/HLSManager.cpp
View file @
2741ffe6
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "HLSManager.hpp"
#include "HLSManager.hpp"
#include "../adaptative/logic/RateBasedAdaptationLogic.h"
#include "../adaptative/logic/RateBasedAdaptationLogic.h"
#include "../adaptative/tools/Retrieve.hpp"
#include "../adaptative/tools/Retrieve.hpp"
#include "../adaptative/http/HTTPConnectionManager.h"
#include "playlist/Parser.hpp"
#include "playlist/Parser.hpp"
#include <vlc_stream.h>
#include <vlc_stream.h>
#include <vlc_demux.h>
#include <vlc_demux.h>
...
@@ -102,7 +103,8 @@ bool HLSManager::isHTTPLiveStreaming(stream_t *s)
...
@@ -102,7 +103,8 @@ bool HLSManager::isHTTPLiveStreaming(stream_t *s)
return
false
;
return
false
;
}
}
AbstractAdaptationLogic
*
HLSManager
::
createLogic
(
AbstractAdaptationLogic
::
LogicType
type
)
AbstractAdaptationLogic
*
HLSManager
::
createLogic
(
AbstractAdaptationLogic
::
LogicType
type
,
HTTPConnectionManager
*
conn
)
{
{
switch
(
type
)
switch
(
type
)
{
{
...
@@ -116,9 +118,11 @@ AbstractAdaptationLogic *HLSManager::createLogic(AbstractAdaptationLogic::LogicT
...
@@ -116,9 +118,11 @@ AbstractAdaptationLogic *HLSManager::createLogic(AbstractAdaptationLogic::LogicT
{
{
int
width
=
var_InheritInteger
(
p_demux
,
"adaptative-width"
);
int
width
=
var_InheritInteger
(
p_demux
,
"adaptative-width"
);
int
height
=
var_InheritInteger
(
p_demux
,
"adaptative-height"
);
int
height
=
var_InheritInteger
(
p_demux
,
"adaptative-height"
);
return
new
(
std
::
nothrow
)
RateBasedAdaptationLogic
(
width
,
height
);
RateBasedAdaptationLogic
*
logic
=
new
(
std
::
nothrow
)
RateBasedAdaptationLogic
(
width
,
height
);
conn
->
setDownloadRateObserver
(
logic
);
return
logic
;
}
}
default:
default:
return
PlaylistManager
::
createLogic
(
type
);
return
PlaylistManager
::
createLogic
(
type
,
conn
);
}
}
}
}
modules/demux/hls/HLSManager.hpp
View file @
2741ffe6
...
@@ -35,7 +35,8 @@ namespace hls
...
@@ -35,7 +35,8 @@ namespace hls
AbstractStreamFactory
*
,
AbstractStreamFactory
*
,
logic
::
AbstractAdaptationLogic
::
LogicType
type
);
logic
::
AbstractAdaptationLogic
::
LogicType
type
);
virtual
~
HLSManager
();
virtual
~
HLSManager
();
virtual
AbstractAdaptationLogic
*
createLogic
(
AbstractAdaptationLogic
::
LogicType
);
virtual
AbstractAdaptationLogic
*
createLogic
(
AbstractAdaptationLogic
::
LogicType
,
HTTPConnectionManager
*
);
static
bool
isHTTPLiveStreaming
(
stream_t
*
);
static
bool
isHTTPLiveStreaming
(
stream_t
*
);
};
};
...
...
modules/demux/hls/HLSStreams.cpp
View file @
2741ffe6
...
@@ -121,8 +121,7 @@ block_t * HLSStream::checkBlock(block_t *p_block, bool b_first)
...
@@ -121,8 +121,7 @@ block_t * HLSStream::checkBlock(block_t *p_block, bool b_first)
}
}
AbstractStream
*
HLSStreamFactory
::
create
(
demux_t
*
realdemux
,
const
StreamFormat
&
format
,
AbstractStream
*
HLSStreamFactory
::
create
(
demux_t
*
realdemux
,
const
StreamFormat
&
format
,
AbstractAdaptationLogic
*
logic
,
SegmentTracker
*
tracker
,
SegmentTracker
*
tracker
,
HTTPConnectionManager
*
manager
)
const
HTTPConnectionManager
*
manager
)
const
{
{
HLSStream
*
stream
;
HLSStream
*
stream
;
try
try
...
@@ -131,6 +130,6 @@ AbstractStream * HLSStreamFactory::create(demux_t *realdemux, const StreamFormat
...
@@ -131,6 +130,6 @@ AbstractStream * HLSStreamFactory::create(demux_t *realdemux, const StreamFormat
}
catch
(
int
)
{
}
catch
(
int
)
{
return
NULL
;
return
NULL
;
}
}
stream
->
bind
(
logic
,
tracker
,
manager
);
stream
->
bind
(
tracker
,
manager
);
return
stream
;
return
stream
;
}
}
modules/demux/hls/HLSStreams.hpp
View file @
2741ffe6
...
@@ -52,8 +52,7 @@ namespace hls
...
@@ -52,8 +52,7 @@ namespace hls
{
{
public:
public:
virtual
AbstractStream
*
create
(
demux_t
*
,
const
StreamFormat
&
,
virtual
AbstractStream
*
create
(
demux_t
*
,
const
StreamFormat
&
,
AbstractAdaptationLogic
*
,
SegmentTracker
*
,
SegmentTracker
*
,
HTTPConnectionManager
*
)
const
;
HTTPConnectionManager
*
)
const
;
};
};
}
}
...
...
modules/demux/smooth/SmoothManager.cpp
View file @
2741ffe6
...
@@ -186,7 +186,8 @@ bool SmoothManager::isSmoothStreaming(stream_t *stream)
...
@@ -186,7 +186,8 @@ bool SmoothManager::isSmoothStreaming(stream_t *stream)
return
ret
;
return
ret
;
}
}
AbstractAdaptationLogic
*
SmoothManager
::
createLogic
(
AbstractAdaptationLogic
::
LogicType
type
)
AbstractAdaptationLogic
*
SmoothManager
::
createLogic
(
AbstractAdaptationLogic
::
LogicType
type
,
HTTPConnectionManager
*
conn
)
{
{
switch
(
type
)
switch
(
type
)
{
{
...
@@ -203,6 +204,6 @@ AbstractAdaptationLogic *SmoothManager::createLogic(AbstractAdaptationLogic::Log
...
@@ -203,6 +204,6 @@ AbstractAdaptationLogic *SmoothManager::createLogic(AbstractAdaptationLogic::Log
return
new
(
std
::
nothrow
)
RateBasedAdaptationLogic
(
width
,
height
);
return
new
(
std
::
nothrow
)
RateBasedAdaptationLogic
(
width
,
height
);
}
}
default:
default:
return
PlaylistManager
::
createLogic
(
type
);
return
PlaylistManager
::
createLogic
(
type
,
conn
);
}
}
}
}
modules/demux/smooth/SmoothManager.hpp
View file @
2741ffe6
...
@@ -37,7 +37,8 @@ namespace smooth
...
@@ -37,7 +37,8 @@ namespace smooth
virtual
~
SmoothManager
();
virtual
~
SmoothManager
();
virtual
bool
updatePlaylist
();
//reimpl
virtual
bool
updatePlaylist
();
//reimpl
virtual
AbstractAdaptationLogic
*
createLogic
(
AbstractAdaptationLogic
::
LogicType
);
virtual
AbstractAdaptationLogic
*
createLogic
(
AbstractAdaptationLogic
::
LogicType
,
HTTPConnectionManager
*
);
static
bool
isSmoothStreaming
(
stream_t
*
);
static
bool
isSmoothStreaming
(
stream_t
*
);
...
...
modules/demux/smooth/SmoothStream.cpp
View file @
2741ffe6
...
@@ -58,8 +58,7 @@ block_t * SmoothStream::checkBlock(block_t *p_block, bool)
...
@@ -58,8 +58,7 @@ block_t * SmoothStream::checkBlock(block_t *p_block, bool)
}
}
AbstractStream
*
SmoothStreamFactory
::
create
(
demux_t
*
realdemux
,
const
StreamFormat
&
format
,
AbstractStream
*
SmoothStreamFactory
::
create
(
demux_t
*
realdemux
,
const
StreamFormat
&
format
,
AbstractAdaptationLogic
*
logic
,
SegmentTracker
*
tracker
,
SegmentTracker
*
tracker
,
HTTPConnectionManager
*
manager
)
const
HTTPConnectionManager
*
manager
)
const
{
{
SmoothStream
*
stream
;
SmoothStream
*
stream
;
try
try
...
@@ -68,6 +67,6 @@ AbstractStream * SmoothStreamFactory::create(demux_t *realdemux, const StreamFor
...
@@ -68,6 +67,6 @@ AbstractStream * SmoothStreamFactory::create(demux_t *realdemux, const StreamFor
}
catch
(
int
)
{
}
catch
(
int
)
{
return
NULL
;
return
NULL
;
}
}
stream
->
bind
(
logic
,
tracker
,
manager
);
stream
->
bind
(
tracker
,
manager
);
return
stream
;
return
stream
;
}
}
modules/demux/smooth/SmoothStream.hpp
View file @
2741ffe6
...
@@ -44,8 +44,7 @@ namespace smooth
...
@@ -44,8 +44,7 @@ namespace smooth
{
{
public:
public:
virtual
AbstractStream
*
create
(
demux_t
*
,
const
StreamFormat
&
,
virtual
AbstractStream
*
create
(
demux_t
*
,
const
StreamFormat
&
,
AbstractAdaptationLogic
*
,
SegmentTracker
*
,
SegmentTracker
*
,
HTTPConnectionManager
*
)
const
;
HTTPConnectionManager
*
)
const
;
};
};
}
}
...
...
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