diff options
| author | 2011-08-01 13:55:45 -0700 | |
|---|---|---|
| committer | 2011-08-01 13:55:45 -0700 | |
| commit | a2616220d24b994e79fcbf33f7ce8a311fa9e8ac (patch) | |
| tree | 33c17e44a55289307cbd0ba53f3422ab6e5d1fbc | |
| parent | b7ed8471f1b96aff901149cf9ac29e4b32672f93 (diff) | |
| parent | 5e57c2cf83ef62e9887592b46a4c3352662fb988 (diff) | |
am 5e57c2cf: Merge "Stagefright: Return error if codec takes too long to return a buffer."
* commit '5e57c2cf83ef62e9887592b46a4c3352662fb988':
Stagefright: Return error if codec takes too long to return a buffer.
| -rw-r--r-- | media/libstagefright/OMXCodec.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index b5d00bf6dc8c..ccda13f25cda 100644 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -3015,6 +3015,8 @@ sp<MetaData> OMXCodec::getFormat() { status_t OMXCodec::read( MediaBuffer **buffer, const ReadOptions *options) { + + status_t wait_status = 0; *buffer = NULL; Mutex::Autolock autoLock(mLock); @@ -3084,12 +3086,20 @@ status_t OMXCodec::read( } while (mSeekTimeUs >= 0) { - mBufferFilled.wait(mLock); + wait_status = mBufferFilled.waitRelative(mLock, 3000000000); + if (wait_status) { + LOGE("Timed out waiting for the buffer! Line %d", __LINE__); + return UNKNOWN_ERROR; + } } } while (mState != ERROR && !mNoMoreOutputData && mFilledBuffers.empty()) { - mBufferFilled.wait(mLock); + wait_status = mBufferFilled.waitRelative(mLock, 3000000000); + if (wait_status) { + LOGE("Timed out waiting for the buffer! Line %d", __LINE__); + return UNKNOWN_ERROR; + } } if (mState == ERROR) { |