Skip to content

Commit

Permalink
fix(AppleVideoToolBox): fix err in backgroud recoverage
Browse files Browse the repository at this point in the history
do not create decoder in bg

recreate decoder when SessionErr

Signed-off-by: pingkai <pingkai010@gmail.com>
  • Loading branch information
pingkai authored and skufly committed Mar 4, 2020
1 parent c797182 commit 2129643
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions framework/codec/Apple/AppleVideoToolBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ namespace Cicada {
// return ret;
// mGotFirstFrame = false;

if (meta->extradata && meta->extradata_size > 0) {
if (meta->extradata && meta->extradata_size > 0 && mActive) {
ret = createDecompressionSession(meta->extradata, meta->extradata_size, meta->width, meta->height);

if (ret < 0) {
AF_LOGE("createDecompressionSession error\n");
return ret;
}
}
Expand Down Expand Up @@ -526,8 +527,9 @@ namespace Cicada {
CFRelease(sampleBuffer);

if (rv == kVTInvalidSessionErr) {
mActive = false;
AF_LOGW("kVTInvalidSessionErr\n");
pPacket.reset(packet);
close_decoder();
return -EAGAIN;
}

Expand Down
2 changes: 1 addition & 1 deletion framework/codec/Apple/AppleVideoToolBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ namespace Cicada{
int mInputCount{0};
bool mThrowPacket{false};
std::mutex mActiveStatusMutex;
bool mActive{true};
std::atomic_bool mActive{true};
AFPixelFormat mVTOutFmt = AF_PIX_FMT_NONE;
std::unique_ptr<streamMeta> mPInMeta{nullptr};
std::queue<std::unique_ptr<IAFPacket>> mRecoveryQueue{};
Expand Down

0 comments on commit 2129643

Please sign in to comment.