Skip to content

Commit

Permalink
Add period time to PTS / fix wrong segment 1 for mediaRange
Browse files Browse the repository at this point in the history
  • Loading branch information
peak3d committed Sep 11, 2019
1 parent a5f2b59 commit d6091b8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main.cpp
Expand Up @@ -3403,8 +3403,8 @@ DemuxPacket* CInputStreamAdaptive::DemuxRead(void)

if (iSize)
{
p->dts = static_cast<double>(sr->DTS());
p->pts = static_cast<double>(sr->PTS());
p->dts = static_cast<double>(sr->DTS() + m_session->GetChapterStartTime());
p->pts = static_cast<double>(sr->PTS() + m_session->GetChapterStartTime());
p->duration = static_cast<double>(sr->GetDuration());
p->iStreamId = sr->GetStreamId();
p->iGroupId = 0;
Expand Down
1 change: 1 addition & 0 deletions src/main.h
Expand Up @@ -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; };

Expand Down
6 changes: 3 additions & 3 deletions src/parser/DASHTree.cpp
Expand Up @@ -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_;

Expand Down

0 comments on commit d6091b8

Please sign in to comment.