mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1173631 - [EME] Implement async shutdown in clearkey GMP. r=cpearce
This commit is contained in:
parent
e4e281e7ce
commit
52007e9665
@ -587,6 +587,7 @@ GMPChild::ShutdownComplete()
|
||||
{
|
||||
LOGD("%s", __FUNCTION__);
|
||||
MOZ_ASSERT(mGMPMessageLoop == MessageLoop::current());
|
||||
mAsyncShutdown = nullptr;
|
||||
SendAsyncShutdownComplete();
|
||||
}
|
||||
|
||||
|
45
media/gmp-clearkey/0.1/ClearKeyAsyncShutdown.cpp
Normal file
45
media/gmp-clearkey/0.1/ClearKeyAsyncShutdown.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2015, Mozilla Foundation and contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ClearKeyAsyncShutdown.h"
|
||||
#include "gmp-task-utils.h"
|
||||
|
||||
ClearKeyAsyncShutdown::ClearKeyAsyncShutdown(GMPAsyncShutdownHost *aHostAPI)
|
||||
: mHost(aHostAPI)
|
||||
{
|
||||
CK_LOGD("ClearKeyAsyncShutdown::ClearKeyAsyncShutdown");
|
||||
AddRef();
|
||||
}
|
||||
|
||||
ClearKeyAsyncShutdown::~ClearKeyAsyncShutdown()
|
||||
{
|
||||
CK_LOGD("ClearKeyAsyncShutdown::~ClearKeyAsyncShutdown");
|
||||
}
|
||||
|
||||
void ShutdownTask(ClearKeyAsyncShutdown* aSelf, GMPAsyncShutdownHost* aHost)
|
||||
{
|
||||
// Dumb implementation that just immediately reports completion.
|
||||
// Real GMPs should ensure they are properly shutdown.
|
||||
CK_LOGD("ClearKeyAsyncShutdown::BeginShutdown calling ShutdownComplete");
|
||||
aHost->ShutdownComplete();
|
||||
aSelf->Release();
|
||||
}
|
||||
|
||||
void ClearKeyAsyncShutdown::BeginShutdown()
|
||||
{
|
||||
CK_LOGD("ClearKeyAsyncShutdown::BeginShutdown dispatching asynchronous shutdown task");
|
||||
GetPlatform()->runonmainthread(WrapTaskNM(ShutdownTask, this, mHost));
|
||||
}
|
37
media/gmp-clearkey/0.1/ClearKeyAsyncShutdown.h
Normal file
37
media/gmp-clearkey/0.1/ClearKeyAsyncShutdown.h
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2015, Mozilla Foundation and contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __ClearKeyAsyncShutdown_h__
|
||||
#define __ClearKeyAsyncShutdown_h__
|
||||
|
||||
#include "gmp-async-shutdown.h"
|
||||
#include "RefCounted.h"
|
||||
|
||||
class ClearKeyAsyncShutdown : public GMPAsyncShutdown
|
||||
, public RefCounted
|
||||
{
|
||||
public:
|
||||
explicit ClearKeyAsyncShutdown(GMPAsyncShutdownHost *aHostAPI);
|
||||
|
||||
void BeginShutdown() override;
|
||||
|
||||
private:
|
||||
virtual ~ClearKeyAsyncShutdown();
|
||||
|
||||
GMPAsyncShutdownHost* mHost;
|
||||
};
|
||||
|
||||
#endif // __ClearKeyAsyncShutdown_h__
|
@ -18,7 +18,9 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ClearKeyAsyncShutdown.h"
|
||||
#include "ClearKeySessionManager.h"
|
||||
#include "gmp-api/gmp-async-shutdown.h"
|
||||
#include "gmp-api/gmp-decryption.h"
|
||||
#include "gmp-api/gmp-platform.h"
|
||||
|
||||
@ -68,7 +70,9 @@ GMPGetAPI(const char* aApiName, void* aHostAPI, void** aPluginAPI)
|
||||
*aPluginAPI = new VideoDecoder(static_cast<GMPVideoHost*>(aHostAPI));
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
else if (!strcmp(aApiName, GMP_API_ASYNC_SHUTDOWN)) {
|
||||
*aPluginAPI = new ClearKeyAsyncShutdown(static_cast<GMPAsyncShutdownHost*> (aHostAPI));
|
||||
} else {
|
||||
CK_LOGE("GMPGetAPI couldn't resolve API name |%s|\n", aApiName);
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ SharedLibrary('clearkey')
|
||||
FINAL_TARGET = 'dist/bin/gmp-clearkey/0.1'
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'ClearKeyAsyncShutdown.cpp',
|
||||
'ClearKeyBase64.cpp',
|
||||
'ClearKeyDecryptionManager.cpp',
|
||||
'ClearKeyPersistence.cpp',
|
||||
|
Loading…
Reference in New Issue
Block a user