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_device.h" | 5 #include "content/renderer/media/audio_device.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 bits_per_sample_(16), | 21 bits_per_sample_(16), |
22 sample_rate_(0), | 22 sample_rate_(0), |
23 latency_format_(AudioParameters::AUDIO_PCM_LOW_LATENCY), | 23 latency_format_(AudioParameters::AUDIO_PCM_LOW_LATENCY), |
24 callback_(0), | 24 callback_(0), |
25 is_initialized_(false), | 25 is_initialized_(false), |
26 audio_delay_milliseconds_(0), | 26 audio_delay_milliseconds_(0), |
27 volume_(1.0), | 27 volume_(1.0), |
28 stream_id_(0), | 28 stream_id_(0), |
29 play_on_start_(true), | 29 play_on_start_(true), |
30 is_started_(false), | 30 is_started_(false), |
| 31 shared_memory_handle_(base::SharedMemory::NULLHandle()), |
| 32 socket_handle_(base::SyncSocket::kInvalidHandle), |
31 memory_length_(0) { | 33 memory_length_(0) { |
32 filter_ = RenderThreadImpl::current()->audio_message_filter(); | 34 filter_ = RenderThreadImpl::current()->audio_message_filter(); |
33 } | 35 } |
34 | 36 |
35 AudioDevice::AudioDevice(size_t buffer_size, | 37 AudioDevice::AudioDevice(size_t buffer_size, |
36 int channels, | 38 int channels, |
37 double sample_rate, | 39 double sample_rate, |
38 RenderCallback* callback) | 40 RenderCallback* callback) |
39 : bits_per_sample_(16), | 41 : bits_per_sample_(16), |
40 is_initialized_(false), | 42 is_initialized_(false), |
41 audio_delay_milliseconds_(0), | 43 audio_delay_milliseconds_(0), |
42 volume_(1.0), | 44 volume_(1.0), |
43 stream_id_(0), | 45 stream_id_(0), |
44 play_on_start_(true), | 46 play_on_start_(true), |
45 is_started_(false), | 47 is_started_(false), |
| 48 shared_memory_handle_(base::SharedMemory::NULLHandle()), |
| 49 socket_handle_(base::SyncSocket::kInvalidHandle), |
46 memory_length_(0) { | 50 memory_length_(0) { |
47 filter_ = RenderThreadImpl::current()->audio_message_filter(); | 51 filter_ = RenderThreadImpl::current()->audio_message_filter(); |
48 Initialize(buffer_size, | 52 Initialize(buffer_size, |
49 channels, | 53 channels, |
50 sample_rate, | 54 sample_rate, |
51 AudioParameters::AUDIO_PCM_LOW_LATENCY, | 55 AudioParameters::AUDIO_PCM_LOW_LATENCY, |
52 callback); | 56 callback); |
53 } | 57 } |
54 | 58 |
55 void AudioDevice::Initialize(size_t buffer_size, | 59 void AudioDevice::Initialize(size_t buffer_size, |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 if (audio_thread_.get()) { | 339 if (audio_thread_.get()) { |
336 // Close the socket handler to terminate the main thread function in the | 340 // Close the socket handler to terminate the main thread function in the |
337 // audio thread. | 341 // audio thread. |
338 { | 342 { |
339 base::SyncSocket socket(socket_handle_); | 343 base::SyncSocket socket(socket_handle_); |
340 } | 344 } |
341 audio_thread_->Join(); | 345 audio_thread_->Join(); |
342 audio_thread_.reset(NULL); | 346 audio_thread_.reset(NULL); |
343 } | 347 } |
344 } | 348 } |
OLD | NEW |