OLD | NEW |
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/win/core_audio_util_win.h" | 5 #include "media/audio/win/core_audio_util_win.h" |
6 | 6 |
7 #include <devicetopology.h> | 7 #include <devicetopology.h> |
8 #include <functiondiscoverykeys_devpkey.h> | 8 #include <functiondiscoverykeys_devpkey.h> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 HRESULT hr = GetPreferredAudioParameters(client.get(), params); | 765 HRESULT hr = GetPreferredAudioParameters(client.get(), params); |
766 if (FAILED(hr) || is_output_device || !params->IsValid()) | 766 if (FAILED(hr) || is_output_device || !params->IsValid()) |
767 return hr; | 767 return hr; |
768 | 768 |
769 // The following functionality is only for input devices. | 769 // The following functionality is only for input devices. |
770 DCHECK(!is_output_device); | 770 DCHECK(!is_output_device); |
771 | 771 |
772 // TODO(dalecurtis): Old code rewrote != 1 channels to stereo, do we still | 772 // TODO(dalecurtis): Old code rewrote != 1 channels to stereo, do we still |
773 // need to do the same thing? | 773 // need to do the same thing? |
774 if (params->channels() != 1) { | 774 if (params->channels() != 1) { |
775 params->Reset(params->format(), CHANNEL_LAYOUT_STEREO, 2, | 775 params->Reset(params->format(), CHANNEL_LAYOUT_STEREO, |
776 params->sample_rate(), params->bits_per_sample(), | 776 params->sample_rate(), params->bits_per_sample(), |
777 params->frames_per_buffer()); | 777 params->frames_per_buffer()); |
778 } | 778 } |
779 | 779 |
780 return hr; | 780 return hr; |
781 } | 781 } |
782 | 782 |
783 ChannelConfig CoreAudioUtil::GetChannelConfig(const std::string& device_id, | 783 ChannelConfig CoreAudioUtil::GetChannelConfig(const std::string& device_id, |
784 EDataFlow data_flow) { | 784 EDataFlow data_flow) { |
785 ScopedComPtr<IAudioClient> client( | 785 ScopedComPtr<IAudioClient> client( |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 return false; | 902 return false; |
903 | 903 |
904 // Using the AUDCLNT_BUFFERFLAGS_SILENT flag eliminates the need to | 904 // Using the AUDCLNT_BUFFERFLAGS_SILENT flag eliminates the need to |
905 // explicitly write silence data to the rendering buffer. | 905 // explicitly write silence data to the rendering buffer. |
906 DVLOG(2) << "filling up " << num_frames_to_fill << " frames with silence"; | 906 DVLOG(2) << "filling up " << num_frames_to_fill << " frames with silence"; |
907 return SUCCEEDED(render_client->ReleaseBuffer(num_frames_to_fill, | 907 return SUCCEEDED(render_client->ReleaseBuffer(num_frames_to_fill, |
908 AUDCLNT_BUFFERFLAGS_SILENT)); | 908 AUDCLNT_BUFFERFLAGS_SILENT)); |
909 } | 909 } |
910 | 910 |
911 } // namespace media | 911 } // namespace media |
OLD | NEW |