Commit de1cde08 authored by François Cartegnie's avatar François Cartegnie 🤞

demux: adaptive: force representation in segmentchunks

parent 91f528c9
......@@ -61,13 +61,13 @@ ISegment::~ISegment()
assert(chunksuse.Get() == 0);
}
SegmentChunk * ISegment::getChunk(const std::string &url, HTTPConnectionManager *connManager)
SegmentChunk * ISegment::getChunk(const std::string &url, BaseRepresentation *rep, HTTPConnectionManager *connManager)
{
HTTPChunkBufferedSource *source = new HTTPChunkBufferedSource(url, connManager);
if(startByte != endByte)
source->setBytesRange(BytesRange(startByte, endByte));
connManager->downloader->schedule(source);
return new (std::nothrow) SegmentChunk(this, source);
return new (std::nothrow) SegmentChunk(this, source, rep);
}
void ISegment::onChunkDownload(block_t **, SegmentChunk *, BaseRepresentation *)
......@@ -80,7 +80,7 @@ SegmentChunk* ISegment::toChunk(size_t index, BaseRepresentation *ctxrep, HTTPCo
SegmentChunk *chunk;
try
{
chunk = getChunk(getUrlSegment().toString(index, ctxrep), connManager);
chunk = getChunk(getUrlSegment().toString(index, ctxrep), ctxrep, connManager);
if (!chunk)
return NULL;
}
......@@ -89,8 +89,6 @@ SegmentChunk* ISegment::toChunk(size_t index, BaseRepresentation *ctxrep, HTTPCo
return NULL;
};
chunk->setRepresentation(ctxrep);
return chunk;
}
......
......@@ -89,7 +89,7 @@ namespace adaptive
static const int SEQUENCE_INVALID;
static const int SEQUENCE_FIRST;
virtual SegmentChunk * getChunk(const std::string &, HTTPConnectionManager *);
virtual SegmentChunk * getChunk(const std::string &, BaseRepresentation *, HTTPConnectionManager *);
};
class Segment : public ISegment
......
......@@ -29,12 +29,13 @@
using namespace adaptive::playlist;
using namespace adaptive;
SegmentChunk::SegmentChunk(ISegment *segment_, AbstractChunkSource *source) :
SegmentChunk::SegmentChunk(ISegment *segment_, AbstractChunkSource *source,
BaseRepresentation *rep_) :
AbstractChunk(source)
{
segment = segment_;
segment->chunksuse.Set(segment->chunksuse.Get() + 1);
rep = NULL;
rep = rep_;
discontinuity = segment_->discontinuity;
}
......@@ -44,11 +45,6 @@ SegmentChunk::~SegmentChunk()
segment->chunksuse.Set(segment->chunksuse.Get() - 1);
}
void SegmentChunk::setRepresentation(BaseRepresentation *rep_)
{
rep = rep_;
}
void SegmentChunk::onDownload(block_t **pp_block)
{
segment->onChunkDownload(pp_block, this, rep);
......
......@@ -38,9 +38,8 @@ namespace adaptive
class SegmentChunk : public AbstractChunk
{
public:
SegmentChunk(ISegment *segment, AbstractChunkSource *);
SegmentChunk(ISegment *segment, AbstractChunkSource *, BaseRepresentation *);
virtual ~SegmentChunk();
void setRepresentation(BaseRepresentation *);
virtual void onDownload(block_t **); // reimpl
StreamFormat getStreamFormat() const;
bool discontinuity;
......
......@@ -299,13 +299,13 @@ block_t * ForgedInitSegment::buildMoovBox()
return moov;
}
SegmentChunk * ForgedInitSegment::getChunk(const std::string &, HTTPConnectionManager *)
SegmentChunk * ForgedInitSegment::getChunk(const std::string &, BaseRepresentation *rep, HTTPConnectionManager *)
{
block_t *moov = buildMoovBox();
if(moov)
{
MemoryChunkSource *source = new (std::nothrow) MemoryChunkSource(moov);
return new (std::nothrow) SegmentChunk(this, source);
return new (std::nothrow) SegmentChunk(this, source, rep);
}
return NULL;
......
......@@ -52,7 +52,7 @@ namespace smooth
void setLanguage(const std::string &);
protected:
virtual SegmentChunk * getChunk(const std::string &, HTTPConnectionManager *); /* reimpl */
virtual SegmentChunk * getChunk(const std::string &, BaseRepresentation *, HTTPConnectionManager *); /* reimpl */
private:
void fromWaveFormatEx(const uint8_t *p_data, size_t i_data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment