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

Commit

Permalink
Merge pull request #172 from xingnan/1833
Browse files Browse the repository at this point in the history
[Android] Fix the crash of GetUserMedia
  • Loading branch information
Raphael Kubo da Costa committed Jun 24, 2014
2 parents 6488cb7 + dcf89f9 commit f8b103e
Showing 1 changed file with 14 additions and 0 deletions.
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

0 comments on commit f8b103e

Please sign in to comment.