Skip to content

Commit 5bb3129

Browse files
Jean-Baptiste QueruAndroid Git Automerger
authored andcommitted
am a261622: am 5e57c2c: Merge "Stagefright: Return error if codec takes too long to return a buffer."
* commit 'a2616220d24b994e79fcbf33f7ce8a311fa9e8ac': Stagefright: Return error if codec takes too long to return a buffer.
2 parents f01b3cf + a261622 commit 5bb3129

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

media/libstagefright/OMXCodec.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3015,6 +3015,8 @@ sp<MetaData> OMXCodec::getFormat() {
30153015

30163016
status_t OMXCodec::read(
30173017
MediaBuffer **buffer, const ReadOptions *options) {
3018+
3019+
status_t wait_status = 0;
30183020
*buffer = NULL;
30193021

30203022
Mutex::Autolock autoLock(mLock);
@@ -3084,12 +3086,20 @@ status_t OMXCodec::read(
30843086
}
30853087

30863088
while (mSeekTimeUs >= 0) {
3087-
mBufferFilled.wait(mLock);
3089+
wait_status = mBufferFilled.waitRelative(mLock, 3000000000);
3090+
if (wait_status) {
3091+
LOGE("Timed out waiting for the buffer! Line %d", __LINE__);
3092+
return UNKNOWN_ERROR;
3093+
}
30883094
}
30893095
}
30903096

30913097
while (mState != ERROR && !mNoMoreOutputData && mFilledBuffers.empty()) {
3092-
mBufferFilled.wait(mLock);
3098+
wait_status = mBufferFilled.waitRelative(mLock, 3000000000);
3099+
if (wait_status) {
3100+
LOGE("Timed out waiting for the buffer! Line %d", __LINE__);
3101+
return UNKNOWN_ERROR;
3102+
}
30933103
}
30943104

30953105
if (mState == ERROR) {

0 commit comments

Comments
 (0)