Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

[Android] Fix the crash of GetUserMedia #172

Merged
merged 1 commit into from
Jun 24, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions media/audio/android/audio_manager_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

#include "media/audio/android/audio_manager_android.h"

#include <algorithm>
#include <string>

#include "base/android/build_info.h"
#include "base/android/jni_array.h"
#include "base/android/jni_string.h"
Expand Down Expand Up @@ -236,8 +239,19 @@ AudioInputStream* AudioManagerAndroid::MakeLowLatencyInputStream(
DVLOG(1) << "Creating AudioRecordInputStream";
return new AudioRecordInputStream(this, params);
}

// TODO(xingnan): Crash will happen in the openSL ES library on some IA
// devices like ZTE Geek V975, Use AudioRecordInputStream path instead as
// a workaround. Will fall back after the fix of the bug.
#if defined(ARCH_CPU_X86)
if (base::android::BuildInfo::GetInstance()->sdk_int() < 16)
return NULL;
DVLOG(1) << "Creating AudioRecordInputStream";
return new AudioRecordInputStream(this, params);
#else
DVLOG(1) << "Creating OpenSLESInputStream";
return new OpenSLESInputStream(this, params);
#endif
}

// static
Expand Down