Skip to content

Commit

Permalink
fix(hlsstream): start form the right index when live switching
Browse files Browse the repository at this point in the history
Signed-off-by: pingkai <pingkai010@gmail.com>
  • Loading branch information
pingkai committed Jul 14, 2020
1 parent 35b6674 commit 5293f19
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion framework/demuxer/play_list/HLSStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ namespace Cicada {
mPTracker->setCurSegNum(mPTracker->getFirstSegNum());
}

if (mPTracker->isLive()) {
if (mPTracker->isLive() && !mPTracker->isSeeked()) {
uint64_t curNum;
if (mOpts) {
string value = mOpts->get("liveStartIndex");
Expand Down
1 change: 1 addition & 0 deletions framework/demuxer/play_list/SegmentTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ namespace Cicada {
mCurSegPos = position;
AF_LOGD("1206, setCurSegPosition %llu\n", mCurSegPos);
}
mSeeked = true;
}

}
8 changes: 8 additions & 0 deletions framework/demuxer/play_list/SegmentTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ namespace Cicada {

void setCurSegNum(uint64_t num)
{
mSeeked = true;
mCurSegNum = num;
}

Expand Down Expand Up @@ -79,6 +80,11 @@ namespace Cicada {

int GetRemainSegmentCount();

bool isSeeked()
{
return mSeeked.load();
}

private:
int loadPlayList();

Expand Down Expand Up @@ -112,6 +118,8 @@ namespace Cicada {
std::recursive_mutex mMutex;

std::atomic_int mPlayListStatus{0};

std::atomic_bool mSeeked{false};
};
}

Expand Down

0 comments on commit 5293f19

Please sign in to comment.