diff --git a/src/main.cpp b/src/main.cpp index 2e291b8b2..da9f4ca6d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3403,8 +3403,8 @@ DemuxPacket* CInputStreamAdaptive::DemuxRead(void) if (iSize) { - p->dts = static_cast(sr->DTS()); - p->pts = static_cast(sr->PTS()); + p->dts = static_cast(sr->DTS() + m_session->GetChapterStartTime()); + p->pts = static_cast(sr->PTS() + m_session->GetChapterStartTime()); p->duration = static_cast(sr->GetDuration()); p->iStreamId = sr->GetStreamId(); p->iGroupId = 0; diff --git a/src/main.h b/src/main.h index 7e8f6a0ea..662cbdac8 100644 --- a/src/main.h +++ b/src/main.h @@ -156,6 +156,7 @@ class Session: public adaptive::AdaptiveStreamObserver const char* GetChapterName(int ch) const; int64_t GetChapterPos(int ch) const; bool SeekChapter(int ch); + uint64_t GetChapterStartTime() { return chapter_start_time_; }; double GetChapterSeekTime() { return chapter_seek_time_; }; void ResetChapterSeekTime() { chapter_seek_time_ = 0; }; diff --git a/src/parser/DASHTree.cpp b/src/parser/DASHTree.cpp index 93bf41a81..2ce9c3628 100644 --- a/src/parser/DASHTree.cpp +++ b/src/parser/DASHTree.cpp @@ -278,15 +278,15 @@ start(void *data, const char *el, const char **attr) size_t sz(strlen((const char*)*(attr + 1)) + 1); seg.url = new char[sz]; memcpy((char*)seg.url, (const char*)*(attr + 1), sz); + + if (dash->current_representation_->segments_.data.empty()) + seg.range_end_ = dash->current_representation_->startNumber_; } attr += 2; } if (dash->current_representation_->segments_.data.empty()) - { seg.startPTS_ = dash->base_time_ + dash->current_representation_->ptsOffset_; - seg.range_end_ = dash->current_representation_->startNumber_; - } else seg.startPTS_ = dash->current_representation_->nextPts_ + dash->current_representation_->duration_;