Skip to content

Commit 6f84da5

Browse files
James DongAndroid (Google) Code Review
authored andcommitted
Merge "Don't check mFilledBuffers whether it is empty or not when the port reconfiguration is not meant for buffer reallocation"
2 parents e123612 + 4a0c91f commit 6f84da5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

media/libstagefright/OMXCodec.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace android {
5050

5151
// Treat time out as an error if we have not received any output
5252
// buffers after 3 seconds.
53-
const static int64_t kBufferFilledEventTimeOutUs = 3000000000LL;
53+
const static int64_t kBufferFilledEventTimeOutNs = 3000000000LL;
5454

5555
struct CodecInfo {
5656
const char *mime;
@@ -2325,9 +2325,14 @@ void OMXCodec::onEvent(OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) {
23252325
{
23262326
CODEC_LOGV("OMX_EventPortSettingsChanged(port=%ld, data2=0x%08lx)",
23272327
data1, data2);
2328-
CHECK(mFilledBuffers.empty());
23292328

23302329
if (data2 == 0 || data2 == OMX_IndexParamPortDefinition) {
2330+
// There is no need to check whether mFilledBuffers is empty or not
2331+
// when the OMX_EventPortSettingsChanged is not meant for reallocating
2332+
// the output buffers.
2333+
if (data1 == kPortIndexOutput) {
2334+
CHECK(mFilledBuffers.empty());
2335+
}
23312336
onPortSettingsChanged(data1);
23322337
} else if (data1 == kPortIndexOutput &&
23332338
(data2 == OMX_IndexConfigCommonOutputCrop ||
@@ -3220,7 +3225,7 @@ status_t OMXCodec::waitForBufferFilled_l() {
32203225
// for video encoding.
32213226
return mBufferFilled.wait(mLock);
32223227
}
3223-
status_t err = mBufferFilled.waitRelative(mLock, kBufferFilledEventTimeOutUs);
3228+
status_t err = mBufferFilled.waitRelative(mLock, kBufferFilledEventTimeOutNs);
32243229
if (err != OK) {
32253230
CODEC_LOGE("Timed out waiting for output buffers: %d/%d",
32263231
countBuffersWeOwn(mPortBuffers[kPortIndexInput]),

0 commit comments

Comments
 (0)