Skip to content

Commit

Permalink
feat(hls): parse first dts on start and seek
Browse files Browse the repository at this point in the history
Signed-off-by: pingkai <pingkai010@gmail.com>
  • Loading branch information
pingkai committed Feb 24, 2020
1 parent fa37a8f commit 8bc4386
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions framework/demuxer/DemuxerMetaInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace Cicada {
class DemuxerMetaInfo {
public:
uint64_t id;
std::vector<std::unique_ptr<streamMeta>> meta;
uint64_t id = 0;
std::vector<std::unique_ptr<streamMeta>> meta{};
bool bContinue{false};
};
}

Expand Down
4 changes: 3 additions & 1 deletion framework/demuxer/avFormatDemuxer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ namespace Cicada {
}

// TODO: set it to zero can avoid read and decode more frames,but wen seek to back in hlsstream,will lead pts err
// mCtx->max_ts_probe = 0;
if (mMetaInfo->bContinue) {
mCtx->max_ts_probe = 0;
}
}

ret = avformat_find_stream_info(mCtx, nullptr);
Expand Down
3 changes: 3 additions & 0 deletions framework/demuxer/play_list/HLSStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,8 @@ namespace Cicada {
if (needUpdateMeta) {
mDemuxerMeta->meta.push_back(move(meta));
}

mDemuxerMeta->bContinue = true;
}

mPacketFirstPts = getPackedStreamPTS();
Expand Down Expand Up @@ -1216,6 +1218,7 @@ namespace Cicada {
mIsEOS = false;
mIsDataEOS = false;
mError = 0;
mDemuxerMeta->bContinue = false;

if (mThreadPtr) {
mThreadPtr->start();
Expand Down

0 comments on commit 8bc4386

Please sign in to comment.