зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1484648 - Implement CodecProxy::IsHardwareAccelerated. r=jolin
Differential Revision: https://phabricator.services.mozilla.com/D3789 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
70b6a3456b
Коммит
2cdf517489
|
@ -208,6 +208,8 @@ public:
|
|||
}
|
||||
mIsCodecSupportAdaptivePlayback =
|
||||
mJavaDecoder->IsAdaptivePlaybackSupported();
|
||||
mIsHardwareAccelerated =
|
||||
mJavaDecoder->IsHardwareAccelerated();
|
||||
return InitPromise::CreateAndResolve(TrackInfo::kVideoTrack, __func__);
|
||||
}
|
||||
|
||||
|
@ -272,12 +274,19 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool IsHardwareAccelerated(nsACString& aFailureReason) const override
|
||||
{
|
||||
return mIsHardwareAccelerated;
|
||||
}
|
||||
|
||||
private:
|
||||
const VideoInfo mConfig;
|
||||
GeckoSurface::GlobalRef mSurface;
|
||||
AndroidSurfaceTextureHandle mSurfaceHandle;
|
||||
// Only accessed on reader's task queue.
|
||||
bool mIsCodecSupportAdaptivePlayback = false;
|
||||
// Can be accessed on any thread, but only written on during init.
|
||||
bool mIsHardwareAccelerated = false;
|
||||
// Accessed on mTaskQueue, reader's TaskQueue and Java callback tread.
|
||||
// SimpleMap however is thread-safe, so it's okay to do so.
|
||||
SimpleMap<InputInfo> mInputInfos;
|
||||
|
|
|
@ -15,6 +15,7 @@ interface ICodec {
|
|||
void setCallbacks(in ICodecCallbacks callbacks);
|
||||
boolean configure(in FormatParam format, in GeckoSurface surface, in int flags, in String drmStubId);
|
||||
boolean isAdaptivePlaybackSupported();
|
||||
boolean isHardwareAccelerated();
|
||||
boolean isTunneledPlaybackSupported();
|
||||
void start();
|
||||
void stop();
|
||||
|
|
|
@ -350,6 +350,7 @@ import org.mozilla.gecko.gfx.GeckoSurface;
|
|||
private SamplePool mSamplePool;
|
||||
// Values will be updated after configure called.
|
||||
private volatile boolean mIsAdaptivePlaybackSupported = false;
|
||||
private volatile boolean mIsHardwareAccelerated = false;
|
||||
private boolean mIsTunneledPlaybackSupported = false;
|
||||
|
||||
public synchronized void setCallbacks(ICodecCallbacks callbacks) throws RemoteException {
|
||||
|
@ -399,6 +400,7 @@ import org.mozilla.gecko.gfx.GeckoSurface;
|
|||
Log.w(LOGTAG, "unable to configure " + name + ". Try next.");
|
||||
continue;
|
||||
}
|
||||
mIsHardwareAccelerated = !name.startsWith("OMX.google.");
|
||||
mCodec = codec;
|
||||
mInputProcessor = new InputProcessor();
|
||||
final boolean renderToSurface = surface != null;
|
||||
|
@ -477,6 +479,11 @@ import org.mozilla.gecko.gfx.GeckoSurface;
|
|||
return mIsAdaptivePlaybackSupported;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isHardwareAccelerated() {
|
||||
return mIsHardwareAccelerated;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isTunneledPlaybackSupported() {
|
||||
return mIsTunneledPlaybackSupported;
|
||||
|
|
|
@ -191,6 +191,21 @@ public final class CodecProxy {
|
|||
}
|
||||
}
|
||||
|
||||
@WrapForJNI
|
||||
public synchronized boolean isHardwareAccelerated()
|
||||
{
|
||||
if (mRemote == null) {
|
||||
Log.e(LOGTAG, "cannot check isHardwareAccelerated with an ended codec");
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return mRemote.isHardwareAccelerated();
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@WrapForJNI
|
||||
public synchronized boolean isTunneledPlaybackSupported()
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче