diff options
author | Xin Li <delphij@google.com> | 2019-10-25 10:28:00 -0700 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2019-10-25 10:28:00 -0700 |
commit | b03eb11e8c1c4277326aa2df6a5f49f148151782 (patch) | |
tree | b0389e33dcdd2297db76e6a1742dfc244d22ee1a | |
parent | 03a78366e84291f35c76533d0606afd1bfd7fb5a (diff) | |
parent | 8701769e72d9b733c24dbfb102534ef85e4f6994 (diff) | |
download | av-b03eb11e8c1c4277326aa2df6a5f49f148151782.tar.gz |
Merge Coral/Flame into AOSP master
Bug: 141248619
Change-Id: If06784dea5892911aba0af41595676b3d1f9dc22
Merged-In: I263d5e27eae2fd54359f3e15cb1d1af6f44b03bb
-rw-r--r-- | media/eco/ECOService.cpp | 6 | ||||
-rw-r--r-- | media/eco/ECOSession.cpp | 28 | ||||
-rw-r--r-- | media/eco/include/eco/ECODebug.h | 11 |
3 files changed, 34 insertions, 11 deletions
diff --git a/media/eco/ECOService.cpp b/media/eco/ECOService.cpp index 6cc4be4..e95dee5 100644 --- a/media/eco/ECOService.cpp +++ b/media/eco/ECOService.cpp @@ -49,6 +49,12 @@ ECOService::ECOService() : BnECOService() { ECOLOGI("ECOService::obtainSession w: %d, h: %d, isCameraRecording: %d", width, height, isCameraRecording); + bool disable = property_get_bool(kDisableEcoServiceProperty, false); + if (disable) { + ECOLOGE("ECOService:: Failed to obtainSession as ECOService is disable"); + return STATUS_ERROR(ERROR_UNSUPPORTED, "ECOService is disable"); + } + if (width <= 0) { return STATUS_ERROR(ERROR_ILLEGAL_ARGUMENT, "Width can not be <= 0"); } diff --git a/media/eco/ECOSession.cpp b/media/eco/ECOSession.cpp index 1bdfa61..a7b919f 100644 --- a/media/eco/ECOSession.cpp +++ b/media/eco/ECOSession.cpp @@ -209,13 +209,25 @@ void ECOSession::processSessionStats(const ECOData& stats) { if (width != mWidth) { ECOLOGW("Codec width: %d, expected: %d", width, mWidth); } - ECOLOGV("codec width is %d", width); + ECOLOGV("codec input width is %d", width); } else if (!key.compare(ENCODER_INPUT_HEIGHT)) { int32_t height = std::get<int32_t>(value); if (height != mHeight) { ECOLOGW("Codec height: %d, expected: %d", height, mHeight); } - ECOLOGV("codec height is %d", height); + ECOLOGV("codec input height is %d", height); + } else if (!key.compare(ENCODER_OUTPUT_WIDTH)) { + mOutputWidth = std::get<int32_t>(value); + if (mOutputWidth != mWidth) { + ECOLOGW("Codec output width: %d, expected: %d", mOutputWidth, mWidth); + } + ECOLOGV("codec output width is %d", mOutputWidth); + } else if (!key.compare(ENCODER_OUTPUT_HEIGHT)) { + mOutputHeight = std::get<int32_t>(value); + if (mOutputHeight != mHeight) { + ECOLOGW("Codec output height: %d, expected: %d", mOutputHeight, mHeight); + } + ECOLOGV("codec output height is %d", mOutputHeight); } else { ECOLOGW("Unknown session stats key %s from provider.", key.c_str()); continue; @@ -304,7 +316,8 @@ void ECOSession::processFrameStats(const ECOData& stats) { continue; } else if (!key.compare(FRAME_NUM) || !key.compare(FRAME_PTS_US) || !key.compare(FRAME_TYPE) || !key.compare(FRAME_SIZE_BYTES) || - !key.compare(ENCODER_ACTUAL_BITRATE_BPS)) { + !key.compare(ENCODER_ACTUAL_BITRATE_BPS) || + !key.compare(ENCODER_FRAMERATE_FPS)) { // Only process the keys that are supported by ECOService 1.0. info.set(key, value); } else if (!key.compare(FRAME_AVG_QP)) { @@ -407,8 +420,9 @@ Status ECOSession::removeStatsProvider( const sp<::android::media::eco::IECOServiceStatsProvider>& provider, bool* status) { std::scoped_lock<std::mutex> lock(mSessionLock); // Check if the provider is the same as current provider for the session. - if (provider.get() != mProvider.get()) { + if (IInterface::asBinder(provider) != IInterface::asBinder(mProvider)) { *status = false; + ECOLOGE("Failed to remove provider"); return STATUS_ERROR(ERROR_ILLEGAL_ARGUMENT, "Provider does not match"); } @@ -484,8 +498,9 @@ Status ECOSession::removeInfoListener( const sp<::android::media::eco::IECOServiceInfoListener>& listener, bool* _aidl_return) { std::scoped_lock<std::mutex> lock(mSessionLock); // Check if the listener is the same as current listener for the session. - if (listener.get() != mListener.get()) { + if (IInterface::asBinder(listener) != IInterface::asBinder(mListener)) { *_aidl_return = false; + ECOLOGE("Failed to remove listener"); return STATUS_ERROR(ERROR_ILLEGAL_ARGUMENT, "Listener does not match"); } @@ -495,11 +510,12 @@ Status ECOSession::removeInfoListener( return binder::Status::ok(); } -Status ECOSession::pushNewStats(const ::android::media::eco::ECOData& stats, bool*) { +Status ECOSession::pushNewStats(const ::android::media::eco::ECOData& stats, bool* _aidl_return) { ECOLOGV("ECOSession get new stats type: %s", stats.getDataTypeString().c_str()); std::unique_lock<std::mutex> lock(mStatsQueueLock); mStatsQueue.push_back(stats); mWorkerWaitCV.notify_all(); + *_aidl_return = true; return binder::Status::ok(); } diff --git a/media/eco/include/eco/ECODebug.h b/media/eco/include/eco/ECODebug.h index b250f64..ff0e8b5 100644 --- a/media/eco/include/eco/ECODebug.h +++ b/media/eco/include/eco/ECODebug.h @@ -26,11 +26,12 @@ namespace android { namespace media { namespace eco { -static const char* kDebugLogsLevelProperty = "media.ecoservice.log.level"; -static const char* kDebugLogStats = "media.ecoservice.log.stats"; -static const char* kDebugLogStatsSize = "media.ecoservice.log.stats.size"; -static const char* kDebugLogInfos = "media.ecoservice.log.info"; -static const char* kDebugLogInfosSize = "media.ecoservice.log.info.size"; +static const char* kDisableEcoServiceProperty = "vendor.media.ecoservice.disable"; +static const char* kDebugLogsLevelProperty = "vendor.media.ecoservice.log.level"; +static const char* kDebugLogStats = "vendor.media.ecoservice.log.stats"; +static const char* kDebugLogStatsSize = "vendor.media.ecoservice.log.stats.size"; +static const char* kDebugLogInfos = "vendor.media.ecoservice.log.info"; +static const char* kDebugLogInfosSize = "vendor.media.ecoservice.log.info.size"; // A debug variable that should only be accessed by ECOService through updateLogLevel. It is rare // that this variable will have race condition. But if so, it is ok as this is just for debugging. |