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:
Jean-Yves Avenard 2018-08-20 15:42:33 +00:00
Родитель 70b6a3456b
Коммит 2cdf517489
4 изменённых файлов: 32 добавлений и 0 удалений

Просмотреть файл

@ -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()
{