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

Side by Side Diff: media/audio/mac/audio_manager_mac.cc

Issue 358823002: changed the input low latency input impl to use client's requested buffer size on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang-format Created 6 years, 5 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
« no previous file with comments | « media/audio/mac/audio_low_latency_input_mac.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/mac/audio_manager_mac.h" 5 #include "media/audio/mac/audio_manager_mac.h"
6 6
7 #include <CoreAudio/AudioHardware.h> 7 #include <CoreAudio/AudioHardware.h>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 } 618 }
619 619
620 AudioInputStream* AudioManagerMac::MakeLowLatencyInputStream( 620 AudioInputStream* AudioManagerMac::MakeLowLatencyInputStream(
621 const AudioParameters& params, const std::string& device_id) { 621 const AudioParameters& params, const std::string& device_id) {
622 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); 622 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format());
623 // Gets the AudioDeviceID that refers to the AudioInputDevice with the device 623 // Gets the AudioDeviceID that refers to the AudioInputDevice with the device
624 // unique id. This AudioDeviceID is used to set the device for Audio Unit. 624 // unique id. This AudioDeviceID is used to set the device for Audio Unit.
625 AudioDeviceID audio_device_id = GetAudioDeviceIdByUId(true, device_id); 625 AudioDeviceID audio_device_id = GetAudioDeviceIdByUId(true, device_id);
626 AudioInputStream* stream = NULL; 626 AudioInputStream* stream = NULL;
627 if (audio_device_id != kAudioObjectUnknown) { 627 if (audio_device_id != kAudioObjectUnknown) {
628 // AUAudioInputStream needs to be fed the preferred audio output parameters 628 stream = new AUAudioInputStream(this, params, audio_device_id);
629 // of the matching device so that the buffer size of both input and output
630 // can be matched. See constructor of AUAudioInputStream for more.
631 const std::string associated_output_device(
632 GetAssociatedOutputDeviceID(device_id));
633 const AudioParameters output_params =
634 GetPreferredOutputStreamParameters(
635 associated_output_device.empty() ?
636 AudioManagerBase::kDefaultDeviceId : associated_output_device,
637 params);
638 stream = new AUAudioInputStream(this, params, output_params,
639 audio_device_id);
640 input_streams_.push_back(stream); 629 input_streams_.push_back(stream);
641 } 630 }
642 631
643 return stream; 632 return stream;
644 } 633 }
645 634
646 AudioParameters AudioManagerMac::GetPreferredOutputStreamParameters( 635 AudioParameters AudioManagerMac::GetPreferredOutputStreamParameters(
647 const std::string& output_device_id, 636 const std::string& output_device_id,
648 const AudioParameters& input_params) { 637 const AudioParameters& input_params) {
649 const AudioDeviceID device = GetAudioDeviceIdByUId(false, output_device_id); 638 const AudioDeviceID device = GetAudioDeviceIdByUId(false, output_device_id);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 void AudioManagerMac::ReleaseInputStream(AudioInputStream* stream) { 758 void AudioManagerMac::ReleaseInputStream(AudioInputStream* stream) {
770 input_streams_.remove(stream); 759 input_streams_.remove(stream);
771 AudioManagerBase::ReleaseInputStream(stream); 760 AudioManagerBase::ReleaseInputStream(stream);
772 } 761 }
773 762
774 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) { 763 AudioManager* CreateAudioManager(AudioLogFactory* audio_log_factory) {
775 return new AudioManagerMac(audio_log_factory); 764 return new AudioManagerMac(audio_log_factory);
776 } 765 }
777 766
778 } // namespace media 767 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/mac/audio_low_latency_input_mac.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698