Bug 824230 - Handle UNKNOWN_ERROR in OmxDecoder. r=doublec, a=blocking-basecamp
--- a/content/media/omx/OmxDecoder.cpp
+++ b/content/media/omx/OmxDecoder.cpp
@@ -554,24 +554,33 @@ bool OmxDecoder::ReadVideo(VideoFrame *a
return false;
} else {
return ReadVideo(aFrame, aTimeUs, aKeyframeSkip, aDoSeek);
}
}
else if (err == ERROR_END_OF_STREAM) {
return false;
}
+ else if (err == UNKNOWN_ERROR) {
+ // This sometimes is used to mean "out of memory", but regardless,
+ // don't keep trying to decode if the decoder doesn't want to.
+ return false;
+ }
return true;
}
bool OmxDecoder::ReadAudio(AudioFrame *aFrame, int64_t aSeekTimeUs)
{
status_t err;
+ if (!mAudioBuffer) {
+ return false;
+ }
+
if (mAudioMetadataRead && aSeekTimeUs == -1) {
// Use the data read into the buffer during metadata time
err = OK;
}
else {
ReleaseAudioBuffer();
if (aSeekTimeUs != -1) {
MediaSource::ReadOptions options;
@@ -604,11 +613,14 @@ bool OmxDecoder::ReadAudio(AudioFrame *a
return ReadAudio(aFrame, aSeekTimeUs);
}
}
else if (err == ERROR_END_OF_STREAM) {
if (aFrame->mSize == 0) {
return false;
}
}
+ else if (err == UNKNOWN_ERROR) {
+ return false;
+ }
return true;
}