mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1097449 - Add locking around libav open/close; r=jya
This commit is contained in:
parent
a7be610621
commit
0155ca113a
@ -18,6 +18,7 @@ namespace mozilla
|
||||
{
|
||||
|
||||
bool FFmpegDataDecoder<LIBAV_VER>::sFFmpegInitDone = false;
|
||||
StaticMutex FFmpegDataDecoder<LIBAV_VER>::sMonitor;
|
||||
|
||||
FFmpegDataDecoder<LIBAV_VER>::FFmpegDataDecoder(MediaTaskQueue* aTaskQueue,
|
||||
AVCodecID aCodecID)
|
||||
@ -58,6 +59,8 @@ ChoosePixelFormat(AVCodecContext* aCodecContext, const PixelFormat* aFormats)
|
||||
nsresult
|
||||
FFmpegDataDecoder<LIBAV_VER>::Init()
|
||||
{
|
||||
StaticMutexAutoLock mon(sMonitor);
|
||||
|
||||
FFMPEG_LOG("Initialising FFmpeg decoder.");
|
||||
|
||||
if (!sFFmpegInitDone) {
|
||||
@ -130,6 +133,8 @@ FFmpegDataDecoder<LIBAV_VER>::Flush()
|
||||
nsresult
|
||||
FFmpegDataDecoder<LIBAV_VER>::Shutdown()
|
||||
{
|
||||
StaticMutexAutoLock mon(sMonitor);
|
||||
|
||||
if (sFFmpegInitDone) {
|
||||
avcodec_close(mCodecContext);
|
||||
av_freep(&mCodecContext);
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "PlatformDecoderModule.h"
|
||||
#include "FFmpegLibs.h"
|
||||
#include "mozilla/Vector.h"
|
||||
#include "mozilla/StaticMutex.h"
|
||||
|
||||
namespace mozilla
|
||||
{
|
||||
@ -44,6 +45,7 @@ protected:
|
||||
|
||||
private:
|
||||
static bool sFFmpegInitDone;
|
||||
static StaticMutex sMonitor;
|
||||
|
||||
AVCodecID mCodecID;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user