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

Unified Diff: media/filters/android/media_codec_audio_decoder.cc

Issue 1764813002: Catch CodecException in MediaCodecBridge and return MEDIA_CODEC_ERROR (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dale's comment Created 4 years, 10 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/video_media_codec_decoder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/android/media_codec_audio_decoder.cc
diff --git a/media/filters/android/media_codec_audio_decoder.cc b/media/filters/android/media_codec_audio_decoder.cc
index f23452a4ca38edff8eb860c3ffe473e62348a8b4..aa559cfa5806579578626192d81bc28ca189f3e7 100644
--- a/media/filters/android/media_codec_audio_decoder.cc
+++ b/media/filters/android/media_codec_audio_decoder.cc
@@ -507,9 +507,13 @@ void MediaCodecAudioDecoder::OnDecodedFrame(const OutputBufferInfo& out) {
// Copy data into AudioBuffer.
CHECK_LE(out.size, audio_buffer->data_size());
- media_codec_->CopyFromOutputBuffer(out.buf_index, out.offset,
- audio_buffer->channel_data()[0],
- audio_buffer->data_size());
+ MediaCodecStatus status = media_codec_->CopyFromOutputBuffer(
+ out.buf_index, out.offset, audio_buffer->channel_data()[0],
+ audio_buffer->data_size());
+ // TODO(timav,watk): This CHECK maintains the behavior of this call before
+ // we started catching CodecException and returning it as MEDIA_CODEC_ERROR.
+ // It needs to be handled some other way. http://crbug.com/585978
+ CHECK_EQ(status, MEDIA_CODEC_OK);
// Release MediaCodec output buffer.
media_codec_->ReleaseOutputBuffer(out.buf_index, false);
@@ -521,9 +525,14 @@ void MediaCodecAudioDecoder::OnDecodedFrame(const OutputBufferInfo& out) {
void MediaCodecAudioDecoder::OnOutputFormatChanged() {
DVLOG(2) << __FUNCTION__;
- // We do not support the change of sampling rate on the fly
- int new_sampling_rate = media_codec_->GetOutputSamplingRate();
- if (new_sampling_rate != config_.samples_per_second()) {
+ int new_sampling_rate;
+ MediaCodecStatus status =
+ media_codec_->GetOutputSamplingRate(&new_sampling_rate);
+ if (status != MEDIA_CODEC_OK) {
+ DVLOG(0) << "GetOutputSamplingRate failed.";
+ SetState(STATE_ERROR);
+ } else if (new_sampling_rate != config_.samples_per_second()) {
+ // We do not support the change of sampling rate on the fly
DVLOG(0) << "Sampling rate change is not supported by" << GetDisplayName()
<< " (detected change " << config_.samples_per_second() << "->"
<< new_sampling_rate << ")";
« no previous file with comments | « media/base/android/video_media_codec_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698