Skip to content

Commit

Permalink
refactor(ActiveDecoder): enbale find h264 keyframe
Browse files Browse the repository at this point in the history
Signed-off-by: pingkai <pingkai010@gmail.com>
  • Loading branch information
pingkai committed Feb 28, 2020
1 parent 9ceea88 commit 7ce822c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions framework/codec/ActiveDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,6 @@ bool ActiveDecoder::needDrop(IAFPacket *packet)
return true;
}

// TODO: make sure HEVC not need drop also
if (packet->getInfo().codec_id != AF_CODEC_ID_HEVC) {
return false;
}

if (bNeedKeyFrame) { // need a key frame, when first start or after seek
if ((packet->getInfo().flags & AF_PKT_FLAG_KEY) == 0) { // drop the frame that not a key frame
// TODO: return error?
Expand All @@ -160,6 +155,11 @@ bool ActiveDecoder::needDrop(IAFPacket *packet)
keyPts = INT64_MIN; // get the next key frame, stop to check
}

// TODO: make sure HEVC not need drop also
if (packet->getInfo().codec_id != AF_CODEC_ID_HEVC) {
return false;
}

if (packet->getInfo().pts < keyPts) { // after get the key frame, check the wrong frame use pts
AF_LOGW("key pts is %lld,pts is %lld\n", keyPts, packet->getInfo().pts);
AF_LOGW("drop a error frame\n");
Expand Down

0 comments on commit 7ce822c

Please sign in to comment.