[vlc-commits] demux: adaptive: recreate stream for each demux
Francois Cartegnie
git at videolan.org
Tue Jun 28 18:21:51 CEST 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jun 28 18:19:07 2016 +0200| [5cc0c5bed240d89de6cc1d9685e9ea7252e38641] | committer: Francois Cartegnie
demux: adaptive: recreate stream for each demux
regression following 70a05fb54763bc5ed9bf78edcdffc9c186611ef9
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5cc0c5bed240d89de6cc1d9685e9ea7252e38641
---
modules/demux/adaptive/plumbing/Demuxer.cpp | 11 ++++----
modules/demux/adaptive/plumbing/SourceStream.cpp | 29 ++++++++++------------
modules/demux/adaptive/plumbing/SourceStream.hpp | 6 ++---
3 files changed, 22 insertions(+), 24 deletions(-)
diff --git a/modules/demux/adaptive/plumbing/Demuxer.cpp b/modules/demux/adaptive/plumbing/Demuxer.cpp
index 1ad942e..f2086d5 100644
--- a/modules/demux/adaptive/plumbing/Demuxer.cpp
+++ b/modules/demux/adaptive/plumbing/Demuxer.cpp
@@ -72,18 +72,20 @@ Demuxer::Demuxer(demux_t *p_realdemux_, const std::string &name_, es_out_t *out,
Demuxer::~Demuxer()
{
if(p_demux)
- {
- p_demux->s = NULL; // otherwise tries to delete below inner stream
demux_Delete(p_demux);
- }
}
bool Demuxer::create()
{
+ stream_t *p_newstream = sourcestream->makeStream();
+ if(!p_newstream)
+ return false;
+
p_demux = demux_New( VLC_OBJECT(p_realdemux), name.c_str(), "",
- sourcestream->getStream(), p_es_out );
+ p_newstream, p_es_out );
if(!p_demux)
{
+ stream_Delete(p_newstream);
b_eof = true;
return false;
}
@@ -95,7 +97,6 @@ bool Demuxer::restart(CommandsQueue &queue)
if(p_demux)
{
queue.setDrop(true);
- p_demux->s = NULL; // otherwise tries to delete below inner stream
demux_Delete(p_demux);
p_demux = NULL;
queue.setDrop(false);
diff --git a/modules/demux/adaptive/plumbing/SourceStream.cpp b/modules/demux/adaptive/plumbing/SourceStream.cpp
index 01bca54..98f9b71 100644
--- a/modules/demux/adaptive/plumbing/SourceStream.cpp
+++ b/modules/demux/adaptive/plumbing/SourceStream.cpp
@@ -31,28 +31,16 @@
using namespace adaptive;
-ChunksSourceStream::ChunksSourceStream(vlc_object_t *p_obj, ChunksSource *source_)
+ChunksSourceStream::ChunksSourceStream(vlc_object_t *p_obj_, ChunksSource *source_)
{
p_block = NULL;
b_eof = false;
-
- custom_stream = stream_CustomNew( p_obj, delete_Callback );
- if(!custom_stream)
- throw VLC_EGENERIC;
-
- custom_stream->pf_control = control_Callback;
- custom_stream->pf_read = read_Callback;
- custom_stream->pf_readdir = NULL;
- custom_stream->pf_seek = seek_Callback;
- custom_stream->p_sys = reinterpret_cast<stream_sys_t*>(this);
-
+ p_obj = p_obj_;
source = source_;
}
ChunksSourceStream::~ChunksSourceStream()
{
- if (custom_stream)
- stream_Delete(custom_stream);
Reset();
}
@@ -64,9 +52,18 @@ void ChunksSourceStream::Reset()
b_eof = false;
}
-stream_t * ChunksSourceStream::getStream()
+stream_t * ChunksSourceStream::makeStream()
{
- return custom_stream;
+ stream_t *p_stream = stream_CustomNew( p_obj, delete_Callback );
+ if(p_stream)
+ {
+ p_stream->pf_control = control_Callback;
+ p_stream->pf_read = read_Callback;
+ p_stream->pf_readdir = NULL;
+ p_stream->pf_seek = seek_Callback;
+ p_stream->p_sys = reinterpret_cast<stream_sys_t*>(this);
+ }
+ return p_stream;
}
ssize_t ChunksSourceStream::Read(uint8_t *buf, size_t size)
diff --git a/modules/demux/adaptive/plumbing/SourceStream.hpp b/modules/demux/adaptive/plumbing/SourceStream.hpp
index 3726e9a..6ab9c4e 100644
--- a/modules/demux/adaptive/plumbing/SourceStream.hpp
+++ b/modules/demux/adaptive/plumbing/SourceStream.hpp
@@ -31,7 +31,7 @@ namespace adaptive
{
public:
virtual ~AbstractSourceStream() {}
- virtual stream_t *getStream() = 0;
+ virtual stream_t *makeStream() = 0;
virtual void Reset() = 0;
};
@@ -40,7 +40,7 @@ namespace adaptive
public:
ChunksSourceStream(vlc_object_t *, ChunksSource *);
virtual ~ChunksSourceStream();
- virtual stream_t *getStream(); /* impl */
+ virtual stream_t *makeStream(); /* impl */
virtual void Reset(); /* impl */
protected:
@@ -53,7 +53,7 @@ namespace adaptive
static int seek_Callback(stream_t *, uint64_t);
static int control_Callback( stream_t *, int i_query, va_list );
static void delete_Callback( stream_t * );
- stream_t *custom_stream;
+ vlc_object_t *p_obj;
ChunksSource *source;
};
More information about the vlc-commits
mailing list