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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 size_t RendererWebKitPlatformSupportImpl::audioHardwareBufferSize() { | 563 size_t RendererWebKitPlatformSupportImpl::audioHardwareBufferSize() { |
564 return audio_hardware::GetOutputBufferSize(); | 564 return audio_hardware::GetOutputBufferSize(); |
565 } | 565 } |
566 | 566 |
567 WebAudioDevice* | 567 WebAudioDevice* |
568 RendererWebKitPlatformSupportImpl::createAudioDevice( | 568 RendererWebKitPlatformSupportImpl::createAudioDevice( |
569 size_t bufferSize, | 569 size_t bufferSize, |
570 unsigned numberOfChannels, | 570 unsigned numberOfChannels, |
571 double sampleRate, | 571 double sampleRate, |
572 WebAudioDevice::RenderCallback* callback) { | 572 WebAudioDevice::RenderCallback* callback) { |
573 ChannelLayout layout = CHANNEL_LAYOUT_UNSUPPORTED; | 573 media::ChannelLayout layout = media::CHANNEL_LAYOUT_UNSUPPORTED; |
574 | 574 |
575 // The |numberOfChannels| does not exactly identify the channel layout of the | 575 // The |numberOfChannels| does not exactly identify the channel layout of the |
576 // device. The switch statement below assigns a best guess to the channel | 576 // device. The switch statement below assigns a best guess to the channel |
577 // layout based on number of channels. | 577 // layout based on number of channels. |
578 // TODO(crogers): WebKit should give the channel layout instead of the hard | 578 // TODO(crogers): WebKit should give the channel layout instead of the hard |
579 // channel count. | 579 // channel count. |
580 switch (numberOfChannels) { | 580 switch (numberOfChannels) { |
581 case 1: | 581 case 1: |
582 layout = CHANNEL_LAYOUT_MONO; | 582 layout = media::CHANNEL_LAYOUT_MONO; |
583 break; | 583 break; |
584 case 2: | 584 case 2: |
585 layout = CHANNEL_LAYOUT_STEREO; | 585 layout = media::CHANNEL_LAYOUT_STEREO; |
586 break; | 586 break; |
587 case 3: | 587 case 3: |
588 layout = CHANNEL_LAYOUT_2_1; | 588 layout = media::CHANNEL_LAYOUT_2_1; |
589 break; | 589 break; |
590 case 4: | 590 case 4: |
591 layout = CHANNEL_LAYOUT_4_0; | 591 layout = media::CHANNEL_LAYOUT_4_0; |
592 break; | 592 break; |
593 case 5: | 593 case 5: |
594 layout = CHANNEL_LAYOUT_5_0; | 594 layout = media::CHANNEL_LAYOUT_5_0; |
595 break; | 595 break; |
596 case 6: | 596 case 6: |
597 layout = CHANNEL_LAYOUT_5_1; | 597 layout = media::CHANNEL_LAYOUT_5_1; |
598 break; | 598 break; |
599 case 7: | 599 case 7: |
600 layout = CHANNEL_LAYOUT_7_0; | 600 layout = media::CHANNEL_LAYOUT_7_0; |
601 break; | 601 break; |
602 case 8: | 602 case 8: |
603 layout = CHANNEL_LAYOUT_7_1; | 603 layout = media::CHANNEL_LAYOUT_7_1; |
604 break; | 604 break; |
605 default: | 605 default: |
606 layout = CHANNEL_LAYOUT_STEREO; | 606 layout = media::CHANNEL_LAYOUT_STEREO; |
607 } | 607 } |
608 | 608 |
609 media::AudioParameters params( | 609 media::AudioParameters params( |
610 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, layout, | 610 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, layout, |
611 static_cast<int>(sampleRate), 16, bufferSize); | 611 static_cast<int>(sampleRate), 16, bufferSize); |
612 | 612 |
613 return new RendererWebAudioDeviceImpl(params, callback); | 613 return new RendererWebAudioDeviceImpl(params, callback); |
614 } | 614 } |
615 | 615 |
616 //------------------------------------------------------------------------------ | 616 //------------------------------------------------------------------------------ |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 const char16* characters, | 753 const char16* characters, |
754 size_t length, | 754 size_t length, |
755 size_t before_index, | 755 size_t before_index, |
756 const WebKit::WebString& locale) { | 756 const WebKit::WebString& locale) { |
757 // Crash if WebKit calls this function when canHyphenate returns false. | 757 // Crash if WebKit calls this function when canHyphenate returns false. |
758 DCHECK(locale.isEmpty() || locale.equals("en-US")); | 758 DCHECK(locale.isEmpty() || locale.equals("en-US")); |
759 DCHECK(hyphenator_.get()); | 759 DCHECK(hyphenator_.get()); |
760 return hyphenator_->ComputeLastHyphenLocation(string16(characters, length), | 760 return hyphenator_->ComputeLastHyphenLocation(string16(characters, length), |
761 before_index); | 761 before_index); |
762 } | 762 } |
OLD | NEW |