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

Side by Side Diff: media/audio/ios/audio_manager_ios.mm

Issue 15979015: Reland 15721002: Hook up the device selection to the WebAudio live audio (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed the comments. Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/audio/ios/audio_manager_ios.h" 5 #include "media/audio/ios/audio_manager_ios.h"
6 6
7 #import <AudioToolbox/AudioToolbox.h> 7 #import <AudioToolbox/AudioToolbox.h>
8 #import <AVFoundation/AVFoundation.h> 8 #import <AVFoundation/AVFoundation.h>
9 9
10 #include "base/sys_info.h" 10 #include "base/sys_info.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // achieve the best audio performance for iOS devices. 55 // achieve the best audio performance for iOS devices.
56 // TODO(xians): query the native channel layout for the specific device. 56 // TODO(xians): query the native channel layout for the specific device.
57 static const int kDefaultSampleRate = 48000; 57 static const int kDefaultSampleRate = 48000;
58 static const int kDefaultBufferSize = 2048; 58 static const int kDefaultBufferSize = 2048;
59 return AudioParameters( 59 return AudioParameters(
60 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, 60 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO,
61 kDefaultSampleRate, 16, kDefaultBufferSize); 61 kDefaultSampleRate, 16, kDefaultBufferSize);
62 } 62 }
63 63
64 AudioOutputStream* AudioManagerIOS::MakeAudioOutputStream( 64 AudioOutputStream* AudioManagerIOS::MakeAudioOutputStream(
65 const AudioParameters& params) { 65 const AudioParameters& params, const std::string& input_device_id) {
66 NOTIMPLEMENTED(); // Only input is supported on iOS. 66 NOTIMPLEMENTED(); // Only input is supported on iOS.
67 return NULL; 67 return NULL;
68 } 68 }
69 69
70 AudioInputStream* AudioManagerIOS::MakeAudioInputStream( 70 AudioInputStream* AudioManagerIOS::MakeAudioInputStream(
71 const AudioParameters& params, const std::string& device_id) { 71 const AudioParameters& params, const std::string& device_id) {
72 // Current line of iOS devices has only one audio input. 72 // Current line of iOS devices has only one audio input.
73 // Ignore the device_id (unittest uses a test value in it). 73 // Ignore the device_id (unittest uses a test value in it).
74 if (!params.IsValid() || (params.channels() > kMaxInputChannels)) 74 if (!params.IsValid() || (params.channels() > kMaxInputChannels))
75 return NULL; 75 return NULL;
76 76
77 if (params.format() == AudioParameters::AUDIO_FAKE) 77 if (params.format() == AudioParameters::AUDIO_FAKE)
78 return FakeAudioInputStream::MakeFakeStream(this, params); 78 return FakeAudioInputStream::MakeFakeStream(this, params);
79 else if (params.format() == AudioParameters::AUDIO_PCM_LINEAR) 79 else if (params.format() == AudioParameters::AUDIO_PCM_LINEAR)
80 return new PCMQueueInAudioInputStream(this, params); 80 return new PCMQueueInAudioInputStream(this, params);
81 return NULL; 81 return NULL;
82 } 82 }
83 83
84 AudioOutputStream* AudioManagerIOS::MakeLinearOutputStream( 84 AudioOutputStream* AudioManagerIOS::MakeLinearOutputStream(
85 const AudioParameters& params) { 85 const AudioParameters& params) {
86 NOTIMPLEMENTED(); // Only input is supported on iOS. 86 NOTIMPLEMENTED(); // Only input is supported on iOS.
87 return NULL; 87 return NULL;
88 } 88 }
89 89
90 AudioOutputStream* AudioManagerIOS::MakeLowLatencyOutputStream( 90 AudioOutputStream* AudioManagerIOS::MakeLowLatencyOutputStream(
91 const AudioParameters& params) { 91 const AudioParameters& params, const std::string& input_device_id) {
92 NOTIMPLEMENTED(); // Only input is supported on iOS. 92 NOTIMPLEMENTED(); // Only input is supported on iOS.
93 return NULL; 93 return NULL;
94 } 94 }
95 95
96 AudioInputStream* AudioManagerIOS::MakeLinearInputStream( 96 AudioInputStream* AudioManagerIOS::MakeLinearInputStream(
97 const AudioParameters& params, const std::string& device_id) { 97 const AudioParameters& params, const std::string& device_id) {
98 return MakeAudioInputStream(params, device_id); 98 return MakeAudioInputStream(params, device_id);
99 } 99 }
100 100
101 AudioInputStream* AudioManagerIOS::MakeLowLatencyInputStream( 101 AudioInputStream* AudioManagerIOS::MakeLowLatencyInputStream(
102 const AudioParameters& params, const std::string& device_id) { 102 const AudioParameters& params, const std::string& device_id) {
103 NOTIMPLEMENTED(); // Only linear audio input is supported on iOS. 103 NOTIMPLEMENTED(); // Only linear audio input is supported on iOS.
104 return MakeAudioInputStream(params, device_id); 104 return MakeAudioInputStream(params, device_id);
105 } 105 }
106 106
107 107
108 AudioParameters AudioManagerIOS::GetPreferredOutputStreamParameters( 108 AudioParameters AudioManagerIOS::GetPreferredOutputStreamParameters(
109 const AudioParameters& input_params) { 109 const AudioParameters& input_params) {
110 // TODO(xians): handle the case when input_params is valid. 110 // TODO(xians): handle the case when input_params is valid.
111 // TODO(xians): figure out the right output sample rate and sample rate to 111 // TODO(xians): figure out the right output sample rate and sample rate to
112 // achieve the best audio performance for iOS devices. 112 // achieve the best audio performance for iOS devices.
(...skipping 18 matching lines...) Expand all
131 void AudioManagerIOS::ReleaseInputStream(AudioInputStream* stream) { 131 void AudioManagerIOS::ReleaseInputStream(AudioInputStream* stream) {
132 delete stream; 132 delete stream;
133 } 133 }
134 134
135 // static 135 // static
136 AudioManager* CreateAudioManager() { 136 AudioManager* CreateAudioManager() {
137 return new AudioManagerIOS(); 137 return new AudioManagerIOS();
138 } 138 }
139 139
140 } // namespace media 140 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698