Skip to content

Commit

Permalink
fix(avcodecDecoder): update pts on decode
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 592e622 commit b68426b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions framework/base/media/AVAFPacket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int64_t AVAFPacket::getSize()
return mpkt->size;
}

const AVPacket *AVAFPacket::ToAVPacket()
AVPacket *AVAFPacket::ToAVPacket()
{
return mpkt;
}
Expand Down Expand Up @@ -100,7 +100,7 @@ AVAFFrame::AVAFFrame(AVFrame **frame, IAFFrame::FrameType type) : mType(type)


AVAFFrame::AVAFFrame(AVFrame *frame, FrameType type) : mAvFrame(av_frame_clone(frame)),
mType(type)
mType(type)
{
assert(mAvFrame != nullptr);
copyInfo();
Expand Down
2 changes: 1 addition & 1 deletion framework/base/media/AVAFPacket.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AVAFPacket : public IAFPacket {

int64_t getSize() override;

const AVPacket *ToAVPacket();
AVPacket *ToAVPacket();

explicit operator AVPacket *();

Expand Down
4 changes: 3 additions & 1 deletion framework/codec/avcodecDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ namespace Cicada {
int avcodecDecoder::enqueue_decoder(unique_ptr<IAFPacket> &pPacket)
{
int ret;
const AVPacket *pkt = nullptr;
AVPacket *pkt = nullptr;

if (pPacket) {
auto *avAFPacket = dynamic_cast<AVAFPacket *>(pPacket.get());
Expand All @@ -261,6 +261,8 @@ namespace Cicada {
// TODO: tobe impl
} else {
pkt = avAFPacket->ToAVPacket();
pkt->pts = pPacket->getInfo().pts;
pkt->dts = pPacket->getInfo().dts;
assert(pkt != nullptr);
}
}
Expand Down

0 comments on commit b68426b

Please sign in to comment.