| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/media/media_stream_audio_processor.h" | 5 #include "content/renderer/media/media_stream_audio_processor.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
| 7 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 8 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
| 9 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
| 15 #include "build/build_config.h" |
| 12 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 13 #include "content/renderer/media/media_stream_audio_processor_options.h" | 17 #include "content/renderer/media/media_stream_audio_processor_options.h" |
| 14 #include "content/renderer/media/rtc_media_constraints.h" | 18 #include "content/renderer/media/rtc_media_constraints.h" |
| 15 #include "content/renderer/media/webrtc_audio_device_impl.h" | 19 #include "content/renderer/media/webrtc_audio_device_impl.h" |
| 16 #include "media/audio/audio_parameters.h" | 20 #include "media/audio/audio_parameters.h" |
| 17 #include "media/base/audio_converter.h" | 21 #include "media/base/audio_converter.h" |
| 18 #include "media/base/audio_fifo.h" | 22 #include "media/base/audio_fifo.h" |
| 19 #include "media/base/channel_layout.h" | 23 #include "media/base/channel_layout.h" |
| 20 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 24 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
| 21 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" | 25 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface
.h" |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 int volume, | 702 int volume, |
| 699 bool key_pressed, | 703 bool key_pressed, |
| 700 float* const* output_ptrs) { | 704 float* const* output_ptrs) { |
| 701 DCHECK(audio_processing_); | 705 DCHECK(audio_processing_); |
| 702 DCHECK(capture_thread_checker_.CalledOnValidThread()); | 706 DCHECK(capture_thread_checker_.CalledOnValidThread()); |
| 703 | 707 |
| 704 TRACE_EVENT0("audio", "MediaStreamAudioProcessor::ProcessData"); | 708 TRACE_EVENT0("audio", "MediaStreamAudioProcessor::ProcessData"); |
| 705 | 709 |
| 706 base::subtle::Atomic32 render_delay_ms = | 710 base::subtle::Atomic32 render_delay_ms = |
| 707 base::subtle::Acquire_Load(&render_delay_ms_); | 711 base::subtle::Acquire_Load(&render_delay_ms_); |
| 708 int64 capture_delay_ms = capture_delay.InMilliseconds(); | 712 int64_t capture_delay_ms = capture_delay.InMilliseconds(); |
| 709 DCHECK_LT(capture_delay_ms, | 713 DCHECK_LT(capture_delay_ms, |
| 710 std::numeric_limits<base::subtle::Atomic32>::max()); | 714 std::numeric_limits<base::subtle::Atomic32>::max()); |
| 711 int total_delay_ms = capture_delay_ms + render_delay_ms; | 715 int total_delay_ms = capture_delay_ms + render_delay_ms; |
| 712 if (total_delay_ms > 300) { | 716 if (total_delay_ms > 300) { |
| 713 LOG(WARNING) << "Large audio delay, capture delay: " << capture_delay_ms | 717 LOG(WARNING) << "Large audio delay, capture delay: " << capture_delay_ms |
| 714 << "ms; render delay: " << render_delay_ms << "ms"; | 718 << "ms; render delay: " << render_delay_ms << "ms"; |
| 715 } | 719 } |
| 716 | 720 |
| 717 webrtc::AudioProcessing* ap = audio_processing_.get(); | 721 webrtc::AudioProcessing* ap = audio_processing_.get(); |
| 718 ap->set_stream_delay_ms(total_delay_ms); | 722 ap->set_stream_delay_ms(total_delay_ms); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 744 if (echo_information_) { | 748 if (echo_information_) { |
| 745 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); | 749 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); |
| 746 } | 750 } |
| 747 | 751 |
| 748 // Return 0 if the volume hasn't been changed, and otherwise the new volume. | 752 // Return 0 if the volume hasn't been changed, and otherwise the new volume. |
| 749 return (agc->stream_analog_level() == volume) ? | 753 return (agc->stream_analog_level() == volume) ? |
| 750 0 : agc->stream_analog_level(); | 754 0 : agc->stream_analog_level(); |
| 751 } | 755 } |
| 752 | 756 |
| 753 } // namespace content | 757 } // namespace content |
| OLD | NEW |