Merge "Clearkey plugin didn't handle negative test cases" into oc-dev
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index 4d8dd3c..80aad2f 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -908,9 +908,7 @@
if (listComponents) {
sp<IOMX> omx;
- int32_t trebleOmx = property_get_int32("persist.media.treble_omx", -1);
- if ((trebleOmx == 1) || ((trebleOmx == -1) &&
- property_get_bool("persist.hal.binderization", 0))) {
+ if (property_get_bool("persist.media.treble_omx", true)) {
using namespace ::android::hardware::media::omx::V1_0;
sp<IOmx> tOmx = IOmx::getService();
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index f3fc924..b082654 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -736,9 +736,7 @@
mExtractorDeathListener = new ServiceDeathNotifier(binder, p, MEDIAEXTRACTOR_PROCESS_DEATH);
binder->linkToDeath(mExtractorDeathListener);
- int32_t trebleOmx = property_get_int32("persist.media.treble_omx", -1);
- if ((trebleOmx == 1) || ((trebleOmx == -1) &&
- property_get_bool("persist.hal.binderization", 0))) {
+ if (property_get_bool("persist.media.treble_omx", true)) {
// Treble IOmx
sp<IOmx> omx = IOmx::getService();
if (omx == nullptr) {
diff --git a/media/libmediaplayerservice/MediaRecorderClient.cpp b/media/libmediaplayerservice/MediaRecorderClient.cpp
index 638eec3..6400481 100644
--- a/media/libmediaplayerservice/MediaRecorderClient.cpp
+++ b/media/libmediaplayerservice/MediaRecorderClient.cpp
@@ -450,9 +450,7 @@
}
sCameraChecked = true;
- int32_t trebleOmx = property_get_int32("persist.media.treble_omx", -1);
- if ((trebleOmx == 1) || ((trebleOmx == -1) &&
- property_get_bool("persist.hal.binderization", 0))) {
+ if (property_get_bool("persist.media.treble_omx", true)) {
// Treble IOmx
sp<IOmx> omx = IOmx::getService();
if (omx == nullptr) {
diff --git a/media/libstagefright/MediaCodecSource.cpp b/media/libstagefright/MediaCodecSource.cpp
index 059a730..bb20850 100644
--- a/media/libstagefright/MediaCodecSource.cpp
+++ b/media/libstagefright/MediaCodecSource.cpp
@@ -940,6 +940,10 @@
CHECK(msg->findInt32("err", &err));
ALOGE("Encoder (%s) reported error : 0x%x",
mIsVideo ? "video" : "audio", err);
+ if (!(mFlags & FLAG_USE_SURFACE_INPUT)) {
+ mStopping = true;
+ mPuller->stop();
+ }
signalEOS();
}
break;
diff --git a/media/libstagefright/OMXClient.cpp b/media/libstagefright/OMXClient.cpp
index 1706221..02d275b 100644
--- a/media/libstagefright/OMXClient.cpp
+++ b/media/libstagefright/OMXClient.cpp
@@ -38,9 +38,7 @@
}
status_t OMXClient::connect(bool* trebleFlag) {
- int32_t trebleOmx = property_get_int32("persist.media.treble_omx", -1);
- if ((trebleOmx == 1) || ((trebleOmx == -1) &&
- property_get_bool("persist.hal.binderization", 0))) {
+ if (property_get_bool("persist.media.treble_omx", true)) {
if (trebleFlag != nullptr) {
*trebleFlag = true;
}
diff --git a/media/libstagefright/omx/GraphicBufferSource.cpp b/media/libstagefright/omx/GraphicBufferSource.cpp
index dae1ee9..afbde6a 100644
--- a/media/libstagefright/omx/GraphicBufferSource.cpp
+++ b/media/libstagefright/omx/GraphicBufferSource.cpp
@@ -384,6 +384,7 @@
// to be handled and [pause, 1us], [resume 2us] will be discarded.
bool dropped = false;
bool done = false;
+ bool seeStopAction = false;
if (!mActionQueue.empty()) {
// First scan to check if bufferTimestamp is smaller than first action's timestamp.
ActionItem nextAction = *(mActionQueue.begin());
@@ -431,7 +432,7 @@
dropped = true;
// Clear the whole ActionQueue as recording is done
mActionQueue.clear();
- submitEndOfInputStream_l();
+ seeStopAction = true;
break;
}
default:
@@ -443,6 +444,14 @@
if (dropped) {
releaseBuffer(item.mSlot, item.mFrameNumber, item.mFence);
+ if (seeStopAction) {
+ // Clear all the buffers before setting mEndOfStream and signal EndOfInputStream.
+ if (!releaseAllBuffers()) {
+ ALOGW("Failed to release all the buffers when handling STOP action");
+ }
+ mEndOfStream = true;
+ submitEndOfInputStream_l();
+ }
return true;
}
@@ -922,18 +931,8 @@
if (suspend) {
mSuspended = true;
- while (mNumFramesAvailable > 0) {
- BufferItem item;
- status_t err = acquireBuffer(&item);
-
- if (err != OK) {
- ALOGE("setSuspend: acquireBuffer returned err=%d", err);
- break;
- }
-
- --mNumFramesAvailable;
-
- releaseBuffer(item.mSlot, item.mFrameNumber, item.mFence);
+ if (!releaseAllBuffers()) {
+ ALOGW("Failed to release all the buffers during suspend");
}
return OK;
} else {
@@ -954,6 +953,23 @@
return OK;
}
+bool GraphicBufferSource::releaseAllBuffers() {
+ while (mNumFramesAvailable > 0) {
+ BufferItem item;
+ status_t err = acquireBuffer(&item);
+
+ if (err != OK) {
+ ALOGE("releaseAllBuffers: acquireBuffer fail returned err=%d", err);
+ return false;;
+ }
+
+ --mNumFramesAvailable;
+
+ releaseBuffer(item.mSlot, item.mFrameNumber, item.mFence);
+ }
+ return true;
+}
+
status_t GraphicBufferSource::setRepeatPreviousFrameDelayUs(int64_t repeatAfterUs) {
ALOGV("setRepeatPreviousFrameDelayUs: delayUs=%lld", (long long)repeatAfterUs);
diff --git a/media/libstagefright/omx/GraphicBufferSource.h b/media/libstagefright/omx/GraphicBufferSource.h
index 371c5ed..ab52ce2 100644
--- a/media/libstagefright/omx/GraphicBufferSource.h
+++ b/media/libstagefright/omx/GraphicBufferSource.h
@@ -220,6 +220,8 @@
// Acquire buffer from the consumer
status_t acquireBuffer(BufferItem *bi);
+ bool releaseAllBuffers();
+
// Release buffer to the consumer
void releaseBuffer(int id, uint64_t frameNum, const sp<Fence> &fence);
diff --git a/media/libstagefright/omx/tests/OMXHarness.cpp b/media/libstagefright/omx/tests/OMXHarness.cpp
index cbca461..fcc44d8 100644
--- a/media/libstagefright/omx/tests/OMXHarness.cpp
+++ b/media/libstagefright/omx/tests/OMXHarness.cpp
@@ -78,9 +78,7 @@
}
status_t Harness::initOMX() {
- int32_t trebleOmx = property_get_int32("persist.media.treble_omx", -1);
- if ((trebleOmx == 1) || ((trebleOmx == -1) &&
- property_get_bool("persist.hal.binderization", 0))) {
+ if (property_get_bool("persist.media.treble_omx", true)) {
using namespace ::android::hardware::media::omx::V1_0;
sp<IOmx> tOmx = IOmx::getService();
if (tOmx == nullptr) {
diff --git a/services/mediacodec/main_codecservice.cpp b/services/mediacodec/main_codecservice.cpp
index 38717b5..3a4546b 100644
--- a/services/mediacodec/main_codecservice.cpp
+++ b/services/mediacodec/main_codecservice.cpp
@@ -54,9 +54,7 @@
::android::hardware::configureRpcThreadpool(64, false);
sp<ProcessState> proc(ProcessState::self());
- int32_t trebleOmx = property_get_int32("persist.media.treble_omx", -1);
- if ((trebleOmx == 1) || ((trebleOmx == -1) &&
- property_get_bool("persist.hal.binderization", 0))) {
+ if (property_get_bool("persist.media.treble_omx", true)) {
using namespace ::android::hardware::media::omx::V1_0;
sp<IOmx> omx = new implementation::Omx();
if (omx == nullptr) {