Commit f011974d authored by qinmin@chromium.org's avatar qinmin@chromium.org

capture a top java exception on certain Samsung devices

This is one of the top crasher on some samsung devices
https://crash.corp.google.com/search?query=android.media.MediaCodec.flush
Capture some exceptions while we are trying to look into the problem

BUG=278464

Review URL: https://chromiumcodereview.appspot.com/23321004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221858 0039d316-1c4b-4281-b951-d872f2087c98
parent 70641311
......@@ -193,12 +193,18 @@ class MediaCodecBridge {
}
@CalledByNative
private void flush() {
mMediaCodec.flush();
mFlushed = true;
if (mAudioTrack != null) {
mAudioTrack.flush();
private int flush() {
try {
mFlushed = true;
if (mAudioTrack != null) {
mAudioTrack.flush();
}
mMediaCodec.flush();
} catch(IllegalStateException e) {
Log.e(TAG, "Failed to flush MediaCodec " + e.toString());
return MEDIA_CODEC_ERROR;
}
return MEDIA_CODEC_OK;
}
@CalledByNative
......
......@@ -111,9 +111,10 @@ void MediaCodecBridge::StartInternal() {
GetOutputBuffers();
}
void MediaCodecBridge::Reset() {
MediaCodecStatus MediaCodecBridge::Reset() {
JNIEnv* env = AttachCurrentThread();
Java_MediaCodecBridge_flush(env, j_media_codec_.obj());
return static_cast<MediaCodecStatus>(
Java_MediaCodecBridge_flush(env, j_media_codec_.obj()));
}
void MediaCodecBridge::Stop() {
......
......@@ -54,7 +54,9 @@ class MEDIA_EXPORT MediaCodecBridge {
// DequeueInputBuffer() and DequeueOutputBuffer() become invalid.
// Please note that this clears all the inputs in the media codec. In other
// words, there will be no outputs until new input is provided.
void Reset();
// Returns MEDIA_CODEC_ERROR if an unexpected error happens, or Media_CODEC_OK
// otherwise.
MediaCodecStatus Reset();
// Finishes the decode/encode session. The instance remains active
// and ready to be StartAudio/Video()ed again. HOWEVER, due to the buggy
......
......@@ -231,7 +231,11 @@ void MediaDecoderJob::DecodeInternal(
if (needs_flush) {
DVLOG(1) << "DecodeInternal needs flush.";
input_eos_encountered_ = false;
media_codec_bridge_->Reset();
MediaCodecStatus reset_status = media_codec_bridge_->Reset();
if (MEDIA_CODEC_OK != reset_status) {
callback.Run(reset_status, start_presentation_timestamp, 0);
return;
}
}
MediaCodecStatus input_status = MEDIA_CODEC_INPUT_END_OF_STREAM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment