Bug 1864011 - ensure platform encoder is always shut down before destructed. r=media-playback-reviewers,chunmin

Differential Revision: https://phabricator.services.mozilla.com/D199913
This commit is contained in:
John Lin 2024-01-31 22:17:41 +00:00
parent 949f77d58f
commit 40b2b23c31
3 changed files with 9 additions and 1 deletions

View File

@ -12,6 +12,8 @@
#include "ImageContainer.h"
#include "libyuv/convert_from.h"
#include "mozilla/Logging.h"
#include "mozilla/Unused.h"
#include "nsThreadUtils.h"
namespace mozilla {

View File

@ -23,6 +23,8 @@ class AndroidDataEncoder final : public MediaDataEncoder {
MOZ_ASSERT(mConfig.mSize.width > 0 && mConfig.mSize.height > 0);
MOZ_ASSERT(mTaskQueue);
}
~AndroidDataEncoder() { MOZ_ASSERT(!mJavaEncoder); }
RefPtr<InitPromise> Init() override;
RefPtr<EncodePromise> Encode(const MediaData* aSample) override;
RefPtr<EncodePromise> Drain() override;

View File

@ -137,7 +137,11 @@ WebrtcMediaDataEncoder::WebrtcMediaDataEncoder(
PodZero(&mCodecSpecific.codecSpecific);
}
WebrtcMediaDataEncoder::~WebrtcMediaDataEncoder() = default;
WebrtcMediaDataEncoder::~WebrtcMediaDataEncoder() {
if (mEncoder) {
Shutdown();
}
}
static void InitCodecSpecficInfo(
webrtc::CodecSpecificInfo& aInfo, const webrtc::VideoCodec* aCodecSettings,