Run codecs in a separate process
For now this only runs decoders and Google encoders in the codec process.
Bug: 22775369
Change-Id: Iadd8b6bc2873ddcfaee3e68866642ba74c6949aa
diff --git a/media/libmedia/Android.mk b/media/libmedia/Android.mk
index 285c33e..c095724 100644
--- a/media/libmedia/Android.mk
+++ b/media/libmedia/Android.mk
@@ -30,6 +30,7 @@
AudioSystem.cpp \
mediaplayer.cpp \
IMediaCodecList.cpp \
+ IMediaCodecService.cpp \
IMediaHTTPConnection.cpp \
IMediaHTTPService.cpp \
IMediaLogService.cpp \
diff --git a/media/libmedia/IMediaCodecService.cpp b/media/libmedia/IMediaCodecService.cpp
new file mode 100644
index 0000000..dcf2b27
--- /dev/null
+++ b/media/libmedia/IMediaCodecService.cpp
@@ -0,0 +1,72 @@
+/*
+**
+** Copyright 2015, The Android Open Source Project
+**
+** 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.
+*/
+
+#define LOG_TAG "IMediaCodecService"
+//#define LOG_NDEBUG 0
+
+#include <utils/Log.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <binder/Parcel.h>
+#include <media/IMediaCodecService.h>
+
+namespace android {
+
+enum {
+ GET_OMX = IBinder::FIRST_CALL_TRANSACTION
+};
+
+class BpMediaCodecService : public BpInterface<IMediaCodecService>
+{
+public:
+ BpMediaCodecService(const sp<IBinder>& impl)
+ : BpInterface<IMediaCodecService>(impl)
+ {
+ }
+
+ virtual sp<IOMX> getOMX() {
+ Parcel data, reply;
+ data.writeInterfaceToken(IMediaCodecService::getInterfaceDescriptor());
+ remote()->transact(GET_OMX, data, &reply);
+ return interface_cast<IOMX>(reply.readStrongBinder());
+ }
+
+};
+
+IMPLEMENT_META_INTERFACE(MediaCodecService, "android.media.IMediaCodecService");
+
+// ----------------------------------------------------------------------
+
+status_t BnMediaCodecService::onTransact(
+ uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
+{
+ switch (code) {
+
+ case GET_OMX: {
+ CHECK_INTERFACE(IMediaCodecService, data, reply);
+ sp<IOMX> omx = getOMX();
+ reply->writeStrongBinder(IInterface::asBinder(omx));
+ return NO_ERROR;
+ }
+ default:
+ return BBinder::onTransact(code, data, reply, flags);
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+} // namespace android
diff --git a/media/libmedia/IMediaPlayerService.cpp b/media/libmedia/IMediaPlayerService.cpp
index afc94ab..5ae450a 100644
--- a/media/libmedia/IMediaPlayerService.cpp
+++ b/media/libmedia/IMediaPlayerService.cpp
@@ -41,7 +41,7 @@
CREATE = IBinder::FIRST_CALL_TRANSACTION,
CREATE_MEDIA_RECORDER,
CREATE_METADATA_RETRIEVER,
- GET_OMX,
+ //GET_OMX,
MAKE_CRYPTO,
MAKE_DRM,
MAKE_HDCP,
@@ -87,12 +87,12 @@
return interface_cast<IMediaRecorder>(reply.readStrongBinder());
}
- virtual sp<IOMX> getOMX() {
- Parcel data, reply;
- data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor());
- remote()->transact(GET_OMX, data, &reply);
- return interface_cast<IOMX>(reply.readStrongBinder());
- }
+// virtual sp<IOMX> getOMX() {
+// Parcel data, reply;
+// data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor());
+// remote()->transact(GET_OMX, data, &reply);
+// return interface_cast<IOMX>(reply.readStrongBinder());
+// }
virtual sp<ICrypto> makeCrypto() {
Parcel data, reply;
@@ -179,12 +179,12 @@
reply->writeStrongBinder(IInterface::asBinder(retriever));
return NO_ERROR;
} break;
- case GET_OMX: {
- CHECK_INTERFACE(IMediaPlayerService, data, reply);
- sp<IOMX> omx = getOMX();
- reply->writeStrongBinder(IInterface::asBinder(omx));
- return NO_ERROR;
- } break;
+// case GET_OMX: {
+// CHECK_INTERFACE(IMediaPlayerService, data, reply);
+// sp<IOMX> omx = getOMX();
+// reply->writeStrongBinder(IInterface::asBinder(omx));
+// return NO_ERROR;
+// } break;
case MAKE_CRYPTO: {
CHECK_INTERFACE(IMediaPlayerService, data, reply);
sp<ICrypto> crypto = makeCrypto();