mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-04 21:52:44 +00:00
Bug 1052169: Ignore decode-complete callbacks during OMX decoder shutdown r=jhlin
This commit is contained in:
parent
78c37afd5c
commit
711211a3e9
@ -225,6 +225,7 @@ public:
|
||||
, mStarted(false)
|
||||
, mDecodedFrameLock("WebRTC decoded frame lock")
|
||||
, mCallback(aCallback)
|
||||
, mEnding(false)
|
||||
{
|
||||
// Create binder thread pool required by stagefright.
|
||||
android::ProcessState::self()->startThreadPool();
|
||||
@ -238,6 +239,7 @@ public:
|
||||
|
||||
virtual ~WebrtcOMXDecoder()
|
||||
{
|
||||
CODEC_LOGD("WebrtcOMXH264VideoDecoder:%p OMX destructor", this);
|
||||
if (mStarted) {
|
||||
Stop();
|
||||
}
|
||||
@ -418,6 +420,10 @@ public:
|
||||
{
|
||||
// Store info of this frame. OnNewFrame() will need the timestamp later.
|
||||
MutexAutoLock lock(mDecodedFrameLock);
|
||||
if (mEnding) {
|
||||
mCodec->releaseOutputBuffer(index);
|
||||
return err;
|
||||
}
|
||||
mDecodedFrames.push(frame);
|
||||
}
|
||||
// Ask codec to queue buffer back to native window. OnNewFrame() will be
|
||||
@ -504,6 +510,10 @@ private:
|
||||
return OK;
|
||||
}
|
||||
|
||||
{
|
||||
MutexAutoLock lock(mDecodedFrameLock);
|
||||
mEnding = false;
|
||||
}
|
||||
status_t err = mCodec->start();
|
||||
if (err == OK) {
|
||||
mStarted = true;
|
||||
@ -525,12 +535,14 @@ private:
|
||||
// Drop all 'pending to render' frames.
|
||||
{
|
||||
MutexAutoLock lock(mDecodedFrameLock);
|
||||
mEnding = true;
|
||||
while (!mDecodedFrames.empty()) {
|
||||
mDecodedFrames.pop();
|
||||
}
|
||||
}
|
||||
|
||||
if (mOutputDrain != nullptr) {
|
||||
CODEC_LOGD("decoder's OutputDrain stopping");
|
||||
mOutputDrain->Stop();
|
||||
mOutputDrain = nullptr;
|
||||
}
|
||||
@ -544,7 +556,6 @@ private:
|
||||
MOZ_ASSERT(false);
|
||||
}
|
||||
CODEC_LOGD("OMXOutputDrain decoder stopped");
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -561,8 +572,9 @@ private:
|
||||
RefPtr<OutputDrain> mOutputDrain;
|
||||
webrtc::DecodedImageCallback* mCallback;
|
||||
|
||||
Mutex mDecodedFrameLock; // To protect mDecodedFrames.
|
||||
Mutex mDecodedFrameLock; // To protect mDecodedFrames and mEnding
|
||||
std::queue<EncodedFrame> mDecodedFrames;
|
||||
bool mEnding;
|
||||
};
|
||||
|
||||
class EncOutputDrain : public OMXOutputDrain
|
||||
@ -1111,7 +1123,7 @@ WebrtcOMXH264VideoDecoder::Release()
|
||||
{
|
||||
CODEC_LOGD("WebrtcOMXH264VideoDecoder:%p will be released", this);
|
||||
|
||||
mOMX = nullptr;
|
||||
mOMX = nullptr; // calls Stop()
|
||||
mReservation->ReleaseOMXCodec();
|
||||
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
|
Loading…
x
Reference in New Issue
Block a user