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

Unified Diff: media/audio/ios/audio_manager_ios.mm

Issue 12316131: Moved AudioUtil static functions to AudioManager interfaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: made the GetPreferredOutputStreamParameters protected Created 7 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/audio/ios/audio_manager_ios.h ('k') | media/audio/linux/audio_manager_linux.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « media/audio/ios/audio_manager_ios.h ('k') | media/audio/linux/audio_manager_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698