| 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/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 } | 555 } |
| 556 | 556 |
| 557 double RendererWebKitPlatformSupportImpl::audioHardwareSampleRate() { | 557 double RendererWebKitPlatformSupportImpl::audioHardwareSampleRate() { |
| 558 return GetAudioOutputSampleRate(); | 558 return GetAudioOutputSampleRate(); |
| 559 } | 559 } |
| 560 | 560 |
| 561 size_t RendererWebKitPlatformSupportImpl::audioHardwareBufferSize() { | 561 size_t RendererWebKitPlatformSupportImpl::audioHardwareBufferSize() { |
| 562 return GetAudioOutputBufferSize(); | 562 return GetAudioOutputBufferSize(); |
| 563 } | 563 } |
| 564 | 564 |
| 565 // TODO(crogers): remove deprecated API as soon as WebKit calls new API. |
| 566 WebAudioDevice* |
| 567 RendererWebKitPlatformSupportImpl::createAudioDevice( |
| 568 size_t buffer_size, |
| 569 unsigned channels, |
| 570 double sample_rate, |
| 571 WebAudioDevice::RenderCallback* callback) { |
| 572 return createAudioDevice(buffer_size, 0, channels, sample_rate, callback); |
| 573 } |
| 574 |
| 565 WebAudioDevice* | 575 WebAudioDevice* |
| 566 RendererWebKitPlatformSupportImpl::createAudioDevice( | 576 RendererWebKitPlatformSupportImpl::createAudioDevice( |
| 567 size_t bufferSize, | 577 size_t buffer_size, |
| 568 unsigned numberOfChannels, | 578 unsigned input_channels, |
| 569 double sampleRate, | 579 unsigned channels, |
| 580 double sample_rate, |
| 570 WebAudioDevice::RenderCallback* callback) { | 581 WebAudioDevice::RenderCallback* callback) { |
| 571 media::ChannelLayout layout = media::CHANNEL_LAYOUT_UNSUPPORTED; | 582 media::ChannelLayout layout = media::CHANNEL_LAYOUT_UNSUPPORTED; |
| 572 | 583 |
| 573 // The |numberOfChannels| does not exactly identify the channel layout of the | 584 // The |channels| does not exactly identify the channel layout of the |
| 574 // device. The switch statement below assigns a best guess to the channel | 585 // device. The switch statement below assigns a best guess to the channel |
| 575 // layout based on number of channels. | 586 // layout based on number of channels. |
| 576 // TODO(crogers): WebKit should give the channel layout instead of the hard | 587 // TODO(crogers): WebKit should give the channel layout instead of the hard |
| 577 // channel count. | 588 // channel count. |
| 578 switch (numberOfChannels) { | 589 switch (channels) { |
| 579 case 1: | 590 case 1: |
| 580 layout = media::CHANNEL_LAYOUT_MONO; | 591 layout = media::CHANNEL_LAYOUT_MONO; |
| 581 break; | 592 break; |
| 582 case 2: | 593 case 2: |
| 583 layout = media::CHANNEL_LAYOUT_STEREO; | 594 layout = media::CHANNEL_LAYOUT_STEREO; |
| 584 break; | 595 break; |
| 585 case 3: | 596 case 3: |
| 586 layout = media::CHANNEL_LAYOUT_2_1; | 597 layout = media::CHANNEL_LAYOUT_2_1; |
| 587 break; | 598 break; |
| 588 case 4: | 599 case 4: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 599 break; | 610 break; |
| 600 case 8: | 611 case 8: |
| 601 layout = media::CHANNEL_LAYOUT_7_1; | 612 layout = media::CHANNEL_LAYOUT_7_1; |
| 602 break; | 613 break; |
| 603 default: | 614 default: |
| 604 layout = media::CHANNEL_LAYOUT_STEREO; | 615 layout = media::CHANNEL_LAYOUT_STEREO; |
| 605 } | 616 } |
| 606 | 617 |
| 607 media::AudioParameters params( | 618 media::AudioParameters params( |
| 608 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, layout, | 619 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, layout, |
| 609 static_cast<int>(sampleRate), 16, bufferSize); | 620 static_cast<int>(sample_rate), 16, buffer_size); |
| 610 | 621 |
| 611 return new RendererWebAudioDeviceImpl(params, callback); | 622 return new RendererWebAudioDeviceImpl(params, input_channels, callback); |
| 612 } | 623 } |
| 613 | 624 |
| 614 //------------------------------------------------------------------------------ | 625 //------------------------------------------------------------------------------ |
| 615 | 626 |
| 616 WebKit::WebString | 627 WebKit::WebString |
| 617 RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString( | 628 RendererWebKitPlatformSupportImpl::signedPublicKeyAndChallengeString( |
| 618 unsigned key_size_index, | 629 unsigned key_size_index, |
| 619 const WebKit::WebString& challenge, | 630 const WebKit::WebString& challenge, |
| 620 const WebKit::WebURL& url) { | 631 const WebKit::WebURL& url) { |
| 621 std::string signed_public_key; | 632 std::string signed_public_key; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 size_t before_index, | 761 size_t before_index, |
| 751 const WebKit::WebString& locale) { | 762 const WebKit::WebString& locale) { |
| 752 // Crash if WebKit calls this function when canHyphenate returns false. | 763 // Crash if WebKit calls this function when canHyphenate returns false. |
| 753 DCHECK(locale.isEmpty() || locale.equals("en-US")); | 764 DCHECK(locale.isEmpty() || locale.equals("en-US")); |
| 754 DCHECK(hyphenator_.get()); | 765 DCHECK(hyphenator_.get()); |
| 755 return hyphenator_->ComputeLastHyphenLocation(string16(characters, length), | 766 return hyphenator_->ComputeLastHyphenLocation(string16(characters, length), |
| 756 before_index); | 767 before_index); |
| 757 } | 768 } |
| 758 | 769 |
| 759 } // namespace content | 770 } // namespace content |
| OLD | NEW |