Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Unified Diff: media/base/android/media_source_player.cc

Issue 15822006: add error handling if MediaCodec fails to decode data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't report error on format change Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/android/media_source_player.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « media/base/android/media_source_player.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698