Skip to content

Commit

Permalink
improvement(hlsstream): protect the segment packet which is encrypted
Browse files Browse the repository at this point in the history
Signed-off-by: pingkai <pingkai010@gmail.com>
  • Loading branch information
pingkai committed Jun 11, 2020
1 parent 8ff9bf0 commit bd2ca4b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions framework/demuxer/play_list/HLSStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,7 @@ namespace Cicada {
int HLSStream::updateDecrypter()
{
int ret = 0;
mProtectedBuffer = mCurSeg->encryption.method != SegmentEncryption::NONE;

if (mCurSeg->encryption.method == SegmentEncryption::AES_128 ||
mCurSeg->encryption.method == SegmentEncryption::AES_PRIVATE) {
Expand Down Expand Up @@ -973,6 +974,10 @@ namespace Cicada {

if (packet != nullptr) {
// AF_LOGD("read a frame \n");

if (mProtectedBuffer) {
packet->setProtected();
}
if (mPTracker->getStreamType() != STREAM_TYPE_MIXED) {
packet->getInfo().streamIndex = 0;
}
Expand Down
1 change: 1 addition & 0 deletions framework/demuxer/play_list/HLSStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ namespace Cicada {

std::unique_ptr<DemuxerMetaInfo> mDemuxerMeta = nullptr;
int OpenedStreamIndex = 0;
bool mProtectedBuffer{false};
};
}

Expand Down

0 comments on commit bd2ca4b

Please sign in to comment.