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 <audioclient.h> | 7 #include <audioclient.h> |
8 #include <devicetopology.h> | 8 #include <devicetopology.h> |
9 #include <functiondiscoverykeys_devpkey.h> | 9 #include <functiondiscoverykeys_devpkey.h> |
10 | 10 |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 // See http://msdn.microsoft.com/en-us/library/windows/hardware/ff537083.aspx | 638 // See http://msdn.microsoft.com/en-us/library/windows/hardware/ff537083.aspx |
639 // for more details. | 639 // for more details. |
640 ChannelConfig channel_config = mix_format.dwChannelMask; | 640 ChannelConfig channel_config = mix_format.dwChannelMask; |
641 | 641 |
642 // Convert Microsoft's channel configuration to genric ChannelLayout. | 642 // Convert Microsoft's channel configuration to genric ChannelLayout. |
643 ChannelLayout channel_layout = ChannelConfigToChannelLayout(channel_config); | 643 ChannelLayout channel_layout = ChannelConfigToChannelLayout(channel_config); |
644 | 644 |
645 // Some devices don't appear to set a valid channel layout, so guess based on | 645 // Some devices don't appear to set a valid channel layout, so guess based on |
646 // the number of channels. See http://crbug.com/311906. | 646 // the number of channels. See http://crbug.com/311906. |
647 if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) { | 647 if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) { |
648 VLOG(1) << "Unsupported channel config: " | 648 DVLOG(1) << "Unsupported channel config: " |
649 << std::hex << channel_config | 649 << std::hex << channel_config |
650 << ". Guessing layout by channel count: " | 650 << ". Guessing layout by channel count: " |
651 << std::dec << mix_format.Format.nChannels; | 651 << std::dec << mix_format.Format.nChannels; |
652 channel_layout = GuessChannelLayout(mix_format.Format.nChannels); | 652 channel_layout = GuessChannelLayout(mix_format.Format.nChannels); |
653 } | 653 } |
654 | 654 |
655 // Preferred sample rate. | 655 // Preferred sample rate. |
656 int sample_rate = mix_format.Format.nSamplesPerSec; | 656 int sample_rate = mix_format.Format.nSamplesPerSec; |
657 | 657 |
658 // TODO(henrika): possibly use format.Format.wBitsPerSample here instead. | 658 // TODO(henrika): possibly use format.Format.wBitsPerSample here instead. |
659 // We use a hard-coded value of 16 bits per sample today even if most audio | 659 // We use a hard-coded value of 16 bits per sample today even if most audio |
660 // engines does the actual mixing in 32 bits per sample. | 660 // engines does the actual mixing in 32 bits per sample. |
661 int bits_per_sample = 16; | 661 int bits_per_sample = 16; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 return false; | 848 return false; |
849 | 849 |
850 // Using the AUDCLNT_BUFFERFLAGS_SILENT flag eliminates the need to | 850 // Using the AUDCLNT_BUFFERFLAGS_SILENT flag eliminates the need to |
851 // explicitly write silence data to the rendering buffer. | 851 // explicitly write silence data to the rendering buffer. |
852 DVLOG(2) << "filling up " << num_frames_to_fill << " frames with silence"; | 852 DVLOG(2) << "filling up " << num_frames_to_fill << " frames with silence"; |
853 return SUCCEEDED(render_client->ReleaseBuffer(num_frames_to_fill, | 853 return SUCCEEDED(render_client->ReleaseBuffer(num_frames_to_fill, |
854 AUDCLNT_BUFFERFLAGS_SILENT)); | 854 AUDCLNT_BUFFERFLAGS_SILENT)); |
855 } | 855 } |
856 | 856 |
857 } // namespace media | 857 } // namespace media |
OLD | NEW |