Index: media/audio/ios/audio_manager_ios.mm |
diff --git a/media/audio/ios/audio_manager_ios.mm b/media/audio/ios/audio_manager_ios.mm |
index 8949b1c711bcdfb9377d069e5c492a0c8b0876cb..00b8d79cb7c275df53814dad8018e89f700cda9e 100644 |
--- a/media/audio/ios/audio_manager_ios.mm |
+++ b/media/audio/ios/audio_manager_ios.mm |
@@ -8,9 +8,11 @@ |
#import <AVFoundation/AVFoundation.h> |
#include "base/sys_info.h" |
+#include "media/audio/audio_parameters.h" |
#include "media/audio/fake_audio_input_stream.h" |
#include "media/audio/ios/audio_session_util_ios.h" |
#include "media/audio/mac/audio_input_mac.h" |
+#include "media/base/channel_layout.h" |
#include "media/base/limits.h" |
namespace media { |
@@ -47,6 +49,18 @@ bool AudioManagerIOS::HasAudioInputDevices() { |
return error == kAudioSessionNoError ? audio_input_is_available : false; |
} |
+AudioParameters AudioManagerIOS::GetInputStreamParameters( |
+ const std::string& device_id) { |
+ // TODO(xians): figure out the right input sample rate and buffer size to |
+ // achieve the best audio performance for iOS devices. |
+ // TODO(xians): query the native channel layout for the specific device. |
+ static const int kDefaultSampleRate = 48000; |
+ static const int kDefaultBufferSize = 2048; |
+ return AudioParameters( |
+ AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, |
+ kDefaultSampleRate, 16, kDefaultBufferSize); |
+} |
+ |
AudioOutputStream* AudioManagerIOS::MakeAudioOutputStream( |
const AudioParameters& params) { |
NOTIMPLEMENTED(); // Only input is supported on iOS. |
@@ -90,6 +104,22 @@ AudioInputStream* AudioManagerIOS::MakeLowLatencyInputStream( |
return MakeAudioInputStream(params, device_id); |
} |
+ |
+AudioParameters AudioManagerIOS::GetPreferredOutputStreamParameters( |
+ const AudioParameters& input_params) { |
+ // TODO(xians): handle the case when input_params is valid. |
+ // TODO(xians): figure out the right output sample rate and sample rate to |
+ // achieve the best audio performance for iOS devices. |
+ static const int kDefaultSampleRate = 48000; |
+ static const int kDefaultBufferSize = 2048; |
+ if (input_params.IsValid()) { |
+ NOTREACHED(); |
+ } |
+ return AudioParameters( |
+ AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, |
+ kDefaultSampleRate, 16, kDefaultBufferSize); |
+} |
+ |
// Called by the stream when it has been released by calling Close(). |
void AudioManagerIOS::ReleaseOutputStream(AudioOutputStream* stream) { |
NOTIMPLEMENTED(); // Only input is supported on iOS. |