| 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/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 double RendererWebKitPlatformSupportImpl::audioHardwareSampleRate() { | 603 double RendererWebKitPlatformSupportImpl::audioHardwareSampleRate() { |
| 604 return audio_hardware::GetOutputSampleRate(); | 604 return audio_hardware::GetOutputSampleRate(); |
| 605 } | 605 } |
| 606 | 606 |
| 607 size_t RendererWebKitPlatformSupportImpl::audioHardwareBufferSize() { | 607 size_t RendererWebKitPlatformSupportImpl::audioHardwareBufferSize() { |
| 608 return audio_hardware::GetOutputBufferSize(); | 608 return audio_hardware::GetOutputBufferSize(); |
| 609 } | 609 } |
| 610 | 610 |
| 611 WebAudioDevice* | 611 WebAudioDevice* |
| 612 RendererWebKitPlatformSupportImpl::createAudioDevice( | 612 RendererWebKitPlatformSupportImpl::createAudioDevice( |
| 613 size_t buffer_size, | 613 size_t bufferSize, |
| 614 unsigned channels, | 614 unsigned numberOfChannels, |
| 615 double sample_rate, | 615 double sampleRate, |
| 616 WebAudioDevice::RenderCallback* callback) { | 616 WebAudioDevice::RenderCallback* callback) { |
| 617 return new RendererWebAudioDeviceImpl(buffer_size, | 617 ChannelLayout layout = CHANNEL_LAYOUT_UNSUPPORTED; |
| 618 channels, | 618 |
| 619 sample_rate, | 619 // The |numberOfChannels| does not exactly identify the channel layout of the |
| 620 callback); | 620 // device. The switch statement below assigns a best guess to the channel |
| 621 // layout based on number of channels. |
| 622 // TODO(crogers): WebKit should give the channel layout instead of the hard |
| 623 // channel count. |
| 624 switch (numberOfChannels) { |
| 625 case 1: |
| 626 layout = CHANNEL_LAYOUT_MONO; |
| 627 break; |
| 628 case 2: |
| 629 layout = CHANNEL_LAYOUT_STEREO; |
| 630 break; |
| 631 case 3: |
| 632 layout = CHANNEL_LAYOUT_2_1; |
| 633 break; |
| 634 case 4: |
| 635 layout = CHANNEL_LAYOUT_4_0; |
| 636 break; |
| 637 case 5: |
| 638 layout = CHANNEL_LAYOUT_5_0; |
| 639 break; |
| 640 case 6: |
| 641 layout = CHANNEL_LAYOUT_5_1; |
| 642 break; |
| 643 case 7: |
| 644 layout = CHANNEL_LAYOUT_7_0; |
| 645 break; |
| 646 case 8: |
| 647 layout = CHANNEL_LAYOUT_7_1; |
| 648 break; |
| 649 default: |
| 650 layout = CHANNEL_LAYOUT_STEREO; |
| 651 } |
| 652 |
| 653 AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 654 layout, |
| 655 static_cast<int>(sampleRate), |
| 656 16, |
| 657 bufferSize); |
| 658 |
| 659 return new RendererWebAudioDeviceImpl(params, callback); |
| 621 } | 660 } |
| 622 | 661 |
| 623 //------------------------------------------------------------------------------ | 662 //------------------------------------------------------------------------------ |
| 624 | 663 |
| 625 WebKit::WebString | 664 WebKit::WebString |
| 626 RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString( | 665 RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString( |
| 627 unsigned key_size_index, | 666 unsigned key_size_index, |
| 628 const WebKit::WebString& challenge, | 667 const WebKit::WebString& challenge, |
| 629 const WebKit::WebURL& url) { | 668 const WebKit::WebURL& url) { |
| 630 std::string signed_public_key; | 669 std::string signed_public_key; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 DCHECK(render_thread); | 729 DCHECK(render_thread); |
| 691 if (!render_thread) | 730 if (!render_thread) |
| 692 return NULL; | 731 return NULL; |
| 693 return render_thread->CreateMediaStreamCenter(client); | 732 return render_thread->CreateMediaStreamCenter(client); |
| 694 } | 733 } |
| 695 | 734 |
| 696 GpuChannelHostFactory* | 735 GpuChannelHostFactory* |
| 697 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { | 736 RendererWebKitPlatformSupportImpl::GetGpuChannelHostFactory() { |
| 698 return RenderThreadImpl::current(); | 737 return RenderThreadImpl::current(); |
| 699 } | 738 } |
| OLD | NEW |