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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
319 DCHECK_EQ(state_, AUTHORIZING); | 319 DCHECK_EQ(state_, AUTHORIZING); |
320 | 320 |
321 // It may happen that a second authorization is received as a result to a | 321 // It may happen that a second authorization is received as a result to a |
322 // call to Start() after Stop(). If the status for the second authorization | 322 // call to Start() after Stop(). If the status for the second authorization |
323 // differs from the first, it will not be reflected in |device_status_| | 323 // differs from the first, it will not be reflected in |device_status_| |
324 // to avoid a race. | 324 // to avoid a race. |
325 // This scenario is unlikely. If it occurs, the new value will be | 325 // This scenario is unlikely. If it occurs, the new value will be |
326 // different from OUTPUT_DEVICE_STATUS_OK, so the AudioOutputDevice | 326 // different from OUTPUT_DEVICE_STATUS_OK, so the AudioOutputDevice |
327 // will enter the IPC_CLOSED state anyway, which is the safe thing to do. | 327 // will enter the IPC_CLOSED state anyway, which is the safe thing to do. |
328 // This is preferable to holding a lock. | 328 // This is preferable to holding a lock. |
329 if (!did_receive_auth_.IsSignaled()) | 329 if (!did_receive_auth_.IsSignaled()) { |
330 device_status_ = device_status; | 330 device_status_ = device_status; |
331 UMA_HISTOGRAM_ENUMERATION("Media.Audio.Render.OutputDeviceStatus", | |
DaleCurtis
2016/11/28 18:58:17
Isn't this always going to be timed out?
o1ka
2016/11/29 13:55:58
No, we are here when it's the first time we receiv
| |
332 device_status, OUTPUT_DEVICE_STATUS_MAX + 1); | |
333 } | |
331 | 334 |
332 if (device_status == OUTPUT_DEVICE_STATUS_OK) { | 335 if (device_status == OUTPUT_DEVICE_STATUS_OK) { |
333 state_ = AUTHORIZED; | 336 state_ = AUTHORIZED; |
334 if (!did_receive_auth_.IsSignaled()) { | 337 if (!did_receive_auth_.IsSignaled()) { |
335 output_params_ = output_params; | 338 output_params_ = output_params; |
336 | 339 |
337 // It's possible to not have a matched device obtained via session id. It | 340 // It's possible to not have a matched device obtained via session id. It |
338 // means matching output device through |session_id_| failed and the | 341 // means matching output device through |session_id_| failed and the |
339 // default device is used. | 342 // default device is used. |
340 DCHECK(AudioDeviceDescription::UseSessionIdToSelectDevice(session_id_, | 343 DCHECK(AudioDeviceDescription::UseSessionIdToSelectDevice(session_id_, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
483 render_callback_->Render(output_bus_.get(), std::round(frames_delayed), | 486 render_callback_->Render(output_bus_.get(), std::round(frames_delayed), |
484 frames_skipped); | 487 frames_skipped); |
485 } | 488 } |
486 | 489 |
487 bool AudioOutputDevice::AudioThreadCallback:: | 490 bool AudioOutputDevice::AudioThreadCallback:: |
488 CurrentThreadIsAudioDeviceThread() { | 491 CurrentThreadIsAudioDeviceThread() { |
489 return thread_checker_.CalledOnValidThread(); | 492 return thread_checker_.CalledOnValidThread(); |
490 } | 493 } |
491 | 494 |
492 } // namespace media | 495 } // namespace media |
OLD | NEW |