Index: media/base/android/media_source_player.cc |
diff --git a/media/base/android/media_source_player.cc b/media/base/android/media_source_player.cc |
index 193c1a33fd61c814157c6544d89c43e301809642..7ca6c706774f5a835b170403310a70128bcfd364 100644 |
--- a/media/base/android/media_source_player.cc |
+++ b/media/base/android/media_source_player.cc |
@@ -91,6 +91,7 @@ void MediaDecoderJob::DecodeInternal( |
size_t size = 0; |
base::TimeDelta presentation_timestamp; |
bool end_of_stream = false; |
+ bool decode_succeeded = true; |
int outputBufferIndex = media_codec_bridge_->DequeueOutputBuffer( |
timeout, &offset, &size, &presentation_timestamp, &end_of_stream); |
@@ -103,6 +104,9 @@ void MediaDecoderJob::DecodeInternal( |
break; |
case MediaCodecBridge::INFO_TRY_AGAIN_LATER: |
break; |
+ case MediaCodecBridge::INFO_MEDIA_CODEC_ERROR: |
+ decode_succeeded = false; |
+ break; |
default: |
DCHECK_LE(0, outputBufferIndex); |
if (size == 0 && end_of_stream) |
@@ -130,8 +134,8 @@ void MediaDecoderJob::DecodeInternal( |
return; |
} |
message_loop_->PostTask(FROM_HERE, base::Bind( |
- callback, start_presentation_timestamp, start_wallclock_time, |
- end_of_stream)); |
+ callback, decode_succeeded, start_presentation_timestamp, |
+ start_wallclock_time, end_of_stream)); |
} |
void MediaDecoderJob::ReleaseOutputBuffer( |
@@ -146,7 +150,8 @@ void MediaDecoderJob::ReleaseOutputBuffer( |
} |
media_codec_bridge_->ReleaseOutputBuffer(outputBufferIndex, !is_audio_); |
message_loop_->PostTask(FROM_HERE, base::Bind( |
- callback, presentation_timestamp, base::Time::Now(), end_of_stream)); |
+ callback, true, presentation_timestamp, base::Time::Now(), |
+ end_of_stream)); |
} |
void MediaDecoderJob::Flush() { |
@@ -421,11 +426,18 @@ void MediaSourcePlayer::ProcessPendingEvents() { |
} |
void MediaSourcePlayer::MediaDecoderCallback( |
- bool is_audio, const base::TimeDelta& presentation_timestamp, |
+ bool is_audio, bool decode_succeeded, |
+ const base::TimeDelta& presentation_timestamp, |
const base::Time& wallclock_time, bool end_of_stream) { |
if (active_decoding_tasks_ > 0) |
active_decoding_tasks_--; |
+ if (!decode_succeeded) { |
+ Release(); |
+ OnMediaError(MEDIA_ERROR_DECODE); |
+ return; |
+ } |
+ |
if (pending_event_ != NO_EVENT_PENDING) { |
ProcessPendingEvents(); |
return; |