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 "media/audio/audio_output_device.h" | 5 #include "media/audio/audio_output_device.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 "AudioOutputDevice"); | 252 "AudioOutputDevice"); |
253 | 253 |
254 // We handle the case where Play() and/or Pause() may have been called | 254 // We handle the case where Play() and/or Pause() may have been called |
255 // multiple times before OnStreamCreated() gets called. | 255 // multiple times before OnStreamCreated() gets called. |
256 is_started_ = true; | 256 is_started_ = true; |
257 if (play_on_start_) | 257 if (play_on_start_) |
258 PlayOnIOThread(); | 258 PlayOnIOThread(); |
259 } | 259 } |
260 | 260 |
261 void AudioOutputDevice::OnIPCClosed() { | 261 void AudioOutputDevice::OnIPCClosed() { |
262 ipc_ = NULL; | 262 ipc_.reset(); |
263 } | 263 } |
264 | 264 |
265 void AudioOutputDevice::WillDestroyCurrentMessageLoop() { | 265 void AudioOutputDevice::WillDestroyCurrentMessageLoop() { |
266 LOG(ERROR) << "IO loop going away before the audio device has been stopped"; | 266 LOG(ERROR) << "IO loop going away before the audio device has been stopped"; |
267 ShutDownOnIOThread(); | 267 ShutDownOnIOThread(); |
268 } | 268 } |
269 | 269 |
270 // AudioOutputDevice::AudioThreadCallback | 270 // AudioOutputDevice::AudioThreadCallback |
271 | 271 |
272 AudioOutputDevice::AudioThreadCallback::AudioThreadCallback( | 272 AudioOutputDevice::AudioThreadCallback::AudioThreadCallback( |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 // TODO(dalecurtis): Technically this is not always correct. Due to channel | 342 // TODO(dalecurtis): Technically this is not always correct. Due to channel |
343 // padding for alignment, there may be more data available than this. We're | 343 // padding for alignment, there may be more data available than this. We're |
344 // relying on AudioSyncReader::Read() to parse this with that in mind. Rename | 344 // relying on AudioSyncReader::Read() to parse this with that in mind. Rename |
345 // these methods to Set/GetActualFrameCount(). | 345 // these methods to Set/GetActualFrameCount(). |
346 SetActualDataSizeInBytes( | 346 SetActualDataSizeInBytes( |
347 &shared_memory_, memory_length_, | 347 &shared_memory_, memory_length_, |
348 num_frames * sizeof(*output_bus_->channel(0)) * output_bus_->channels()); | 348 num_frames * sizeof(*output_bus_->channel(0)) * output_bus_->channels()); |
349 } | 349 } |
350 | 350 |
351 } // namespace media. | 351 } // namespace media. |
OLD | NEW |