| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/audio_renderer_impl.h" | 5 #include "content/renderer/media/audio_renderer_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "content/common/child_process.h" | 12 #include "content/common/child_process.h" |
| 13 #include "content/common/content_switches.h" | 13 #include "content/common/content_switches.h" |
| 14 #include "content/common/media/audio_messages.h" | 14 #include "content/common/media/audio_messages.h" |
| 15 #include "content/renderer/render_thread.h" | 15 #include "content/renderer/render_thread_impl.h" |
| 16 #include "content/renderer/render_view.h" | 16 #include "content/renderer/render_view.h" |
| 17 #include "media/audio/audio_buffers_state.h" | 17 #include "media/audio/audio_buffers_state.h" |
| 18 #include "media/audio/audio_output_controller.h" | 18 #include "media/audio/audio_output_controller.h" |
| 19 #include "media/audio/audio_util.h" | 19 #include "media/audio/audio_util.h" |
| 20 #include "media/base/filter_host.h" | 20 #include "media/base/filter_host.h" |
| 21 | 21 |
| 22 // Static variable that says what code path we are using -- low or high | 22 // Static variable that says what code path we are using -- low or high |
| 23 // latency. Made separate variable so we don't have to go to command line | 23 // latency. Made separate variable so we don't have to go to command line |
| 24 // for every DCHECK(). | 24 // for every DCHECK(). |
| 25 AudioRendererImpl::LatencyType AudioRendererImpl::latency_type_ = | 25 AudioRendererImpl::LatencyType AudioRendererImpl::latency_type_ = |
| 26 AudioRendererImpl::kUninitializedLatency; | 26 AudioRendererImpl::kUninitializedLatency; |
| 27 | 27 |
| 28 AudioRendererImpl::AudioRendererImpl() | 28 AudioRendererImpl::AudioRendererImpl() |
| 29 : AudioRendererBase(), | 29 : AudioRendererBase(), |
| 30 bytes_per_second_(0), | 30 bytes_per_second_(0), |
| 31 stream_id_(0), | 31 stream_id_(0), |
| 32 shared_memory_(NULL), | 32 shared_memory_(NULL), |
| 33 shared_memory_size_(0), | 33 shared_memory_size_(0), |
| 34 stopped_(false), | 34 stopped_(false), |
| 35 pending_request_(false), | 35 pending_request_(false), |
| 36 prerolling_(false), | 36 prerolling_(false), |
| 37 preroll_bytes_(0) { | 37 preroll_bytes_(0) { |
| 38 filter_ = RenderThread::current()->audio_message_filter(); | 38 filter_ = RenderThreadImpl::current()->audio_message_filter(); |
| 39 // Figure out if we are planning to use high or low latency code path. | 39 // Figure out if we are planning to use high or low latency code path. |
| 40 // We are initializing only one variable and double initialization is Ok, | 40 // We are initializing only one variable and double initialization is Ok, |
| 41 // so there would not be any issues caused by CPU memory model. | 41 // so there would not be any issues caused by CPU memory model. |
| 42 if (latency_type_ == kUninitializedLatency) { | 42 if (latency_type_ == kUninitializedLatency) { |
| 43 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 43 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 44 switches::kHighLatencyAudio)) { | 44 switches::kHighLatencyAudio)) { |
| 45 latency_type_ = kLowLatency; | 45 latency_type_ = kLowLatency; |
| 46 } else { | 46 } else { |
| 47 latency_type_ = kHighLatency; | 47 latency_type_ = kHighLatency; |
| 48 } | 48 } |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 media::SetActualDataSizeInBytes(shared_memory_.get(), | 492 media::SetActualDataSizeInBytes(shared_memory_.get(), |
| 493 shared_memory_size_, | 493 shared_memory_size_, |
| 494 size); | 494 size); |
| 495 UpdateEarliestEndTime(size, request_delay, time_now); | 495 UpdateEarliestEndTime(size, request_delay, time_now); |
| 496 } | 496 } |
| 497 } | 497 } |
| 498 | 498 |
| 499 void AudioRendererImpl::Send(IPC::Message* message) { | 499 void AudioRendererImpl::Send(IPC::Message* message) { |
| 500 filter_->Send(message); | 500 filter_->Send(message); |
| 501 } | 501 } |
| OLD | NEW |