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 "content/renderer/renderer_webkitplatformsupport_impl.h" | 5 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/platform_file.h" | 11 #include "base/platform_file.h" |
12 #include "base/shared_memory.h" | 12 #include "base/shared_memory.h" |
| 13 #include "base/string_number_conversions.h" |
13 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
14 #include "content/common/database_util.h" | 15 #include "content/common/database_util.h" |
15 #include "content/common/file_utilities_messages.h" | 16 #include "content/common/file_utilities_messages.h" |
16 #include "content/common/gpu/client/context_provider_command_buffer.h" | 17 #include "content/common/gpu/client/context_provider_command_buffer.h" |
17 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 18 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
18 #include "content/common/mime_registry_messages.h" | 19 #include "content/common/mime_registry_messages.h" |
19 #include "content/common/thread_safe_sender.h" | 20 #include "content/common/thread_safe_sender.h" |
20 #include "content/common/view_messages.h" | 21 #include "content/common/view_messages.h" |
21 #include "content/common/webmessageportchannel_impl.h" | 22 #include "content/common/webmessageportchannel_impl.h" |
22 #include "content/common_child/fileapi/webfilesystem_impl.h" | 23 #include "content/common_child/fileapi/webfilesystem_impl.h" |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 } | 675 } |
675 | 676 |
676 WebAudioDevice* | 677 WebAudioDevice* |
677 RendererWebKitPlatformSupportImpl::createAudioDevice( | 678 RendererWebKitPlatformSupportImpl::createAudioDevice( |
678 size_t buffer_size, | 679 size_t buffer_size, |
679 unsigned input_channels, | 680 unsigned input_channels, |
680 unsigned channels, | 681 unsigned channels, |
681 double sample_rate, | 682 double sample_rate, |
682 WebAudioDevice::RenderCallback* callback, | 683 WebAudioDevice::RenderCallback* callback, |
683 const WebKit::WebString& input_device_id) { | 684 const WebKit::WebString& input_device_id) { |
684 if (input_device_id != "default") { | |
685 // Only allow audio input if we know for sure that WebKit is giving us the | |
686 // "default" input device. | |
687 // TODO(crogers): add support for non-default audio input devices when | |
688 // using synchronized audio I/O in WebAudio. | |
689 if (input_channels > 0) | |
690 DLOG(WARNING) << "createAudioDevice(): request for audio input ignored"; | |
691 input_channels = 0; | |
692 } | |
693 | |
694 // The |channels| does not exactly identify the channel layout of the | 685 // The |channels| does not exactly identify the channel layout of the |
695 // device. The switch statement below assigns a best guess to the channel | 686 // device. The switch statement below assigns a best guess to the channel |
696 // layout based on number of channels. | 687 // layout based on number of channels. |
697 // TODO(crogers): WebKit should give the channel layout instead of the hard | 688 // TODO(crogers): WebKit should give the channel layout instead of the hard |
698 // channel count. | 689 // channel count. |
699 media::ChannelLayout layout = media::CHANNEL_LAYOUT_UNSUPPORTED; | 690 media::ChannelLayout layout = media::CHANNEL_LAYOUT_UNSUPPORTED; |
700 switch (channels) { | 691 switch (channels) { |
701 case 1: | 692 case 1: |
702 layout = media::CHANNEL_LAYOUT_MONO; | 693 layout = media::CHANNEL_LAYOUT_MONO; |
703 break; | 694 break; |
(...skipping 15 matching lines...) Expand all Loading... |
719 case 7: | 710 case 7: |
720 layout = media::CHANNEL_LAYOUT_7_0; | 711 layout = media::CHANNEL_LAYOUT_7_0; |
721 break; | 712 break; |
722 case 8: | 713 case 8: |
723 layout = media::CHANNEL_LAYOUT_7_1; | 714 layout = media::CHANNEL_LAYOUT_7_1; |
724 break; | 715 break; |
725 default: | 716 default: |
726 layout = media::CHANNEL_LAYOUT_STEREO; | 717 layout = media::CHANNEL_LAYOUT_STEREO; |
727 } | 718 } |
728 | 719 |
| 720 int session_id = 0; |
| 721 if (input_device_id.isNull() || |
| 722 !base::StringToInt(UTF16ToUTF8(input_device_id), &session_id)) { |
| 723 if (input_channels > 0) |
| 724 DLOG(WARNING) << "createAudioDevice(): request for audio input ignored"; |
| 725 |
| 726 input_channels = 0; |
| 727 } |
| 728 |
729 media::AudioParameters params( | 729 media::AudioParameters params( |
730 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, | 730 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, |
731 layout, input_channels, | 731 layout, input_channels, |
732 static_cast<int>(sample_rate), 16, buffer_size); | 732 static_cast<int>(sample_rate), 16, buffer_size); |
733 | 733 |
734 return new RendererWebAudioDeviceImpl(params, callback); | 734 return new RendererWebAudioDeviceImpl(params, callback, session_id); |
735 } | 735 } |
736 | 736 |
737 //------------------------------------------------------------------------------ | 737 //------------------------------------------------------------------------------ |
738 | 738 |
739 WebKit::WebString | 739 WebKit::WebString |
740 RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString( | 740 RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString( |
741 unsigned key_size_index, | 741 unsigned key_size_index, |
742 const WebKit::WebString& challenge, | 742 const WebKit::WebString& challenge, |
743 const WebKit::WebURL& url) { | 743 const WebKit::WebURL& url) { |
744 std::string signed_public_key; | 744 std::string signed_public_key; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 } | 902 } |
903 | 903 |
904 //------------------------------------------------------------------------------ | 904 //------------------------------------------------------------------------------ |
905 | 905 |
906 WebKit::WebCompositorSupport* | 906 WebKit::WebCompositorSupport* |
907 RendererWebKitPlatformSupportImpl::compositorSupport() { | 907 RendererWebKitPlatformSupportImpl::compositorSupport() { |
908 return &compositor_support_; | 908 return &compositor_support_; |
909 } | 909 } |
910 | 910 |
911 } // namespace content | 911 } // namespace content |
OLD | NEW |