| 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 <limits.h> | 5 #include <limits.h> |
| 6 #include <stddef.h> | 6 #include <stddef.h> |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <climits> | 10 #include <climits> |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 FROM_HERE, | 213 FROM_HERE, |
| 214 base::Bind(&NaivePlayer::StartAudioOutputOnAudioManagerThread, | 214 base::Bind(&NaivePlayer::StartAudioOutputOnAudioManagerThread, |
| 215 base::Unretained(this))); | 215 base::Unretained(this))); |
| 216 // Note: No need to wait for audio polling to start since the push-and-pull | 216 // Note: No need to wait for audio polling to start since the push-and-pull |
| 217 // mechanism is synchronized via the |audio_playout_queue_|. | 217 // mechanism is synchronized via the |audio_playout_queue_|. |
| 218 InProcessReceiver::Start(); | 218 InProcessReceiver::Start(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void Stop() final { | 221 void Stop() final { |
| 222 // First, stop audio output to the Chromium audio stack. | 222 // First, stop audio output to the Chromium audio stack. |
| 223 base::WaitableEvent done(false, false); | 223 base::WaitableEvent done(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 224 base::WaitableEvent::InitialState::NOT_SIGNALED); |
| 224 DCHECK(!AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); | 225 DCHECK(!AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); |
| 225 AudioManager::Get()->GetTaskRunner()->PostTask( | 226 AudioManager::Get()->GetTaskRunner()->PostTask( |
| 226 FROM_HERE, | 227 FROM_HERE, |
| 227 base::Bind(&NaivePlayer::StopAudioOutputOnAudioManagerThread, | 228 base::Bind(&NaivePlayer::StopAudioOutputOnAudioManagerThread, |
| 228 base::Unretained(this), | 229 base::Unretained(this), |
| 229 &done)); | 230 &done)); |
| 230 done.Wait(); | 231 done.Wait(); |
| 231 | 232 |
| 232 // Now, stop receiving new frames. | 233 // Now, stop receiving new frames. |
| 233 InProcessReceiver::Stop(); | 234 InProcessReceiver::Stop(); |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 audio_config, | 599 audio_config, |
| 599 video_config, | 600 video_config, |
| 600 window_width, | 601 window_width, |
| 601 window_height); | 602 window_height); |
| 602 player.Start(); | 603 player.Start(); |
| 603 | 604 |
| 604 message_loop.Run(); // Run forever (i.e., until SIGTERM). | 605 message_loop.Run(); // Run forever (i.e., until SIGTERM). |
| 605 NOTREACHED(); | 606 NOTREACHED(); |
| 606 return 0; | 607 return 0; |
| 607 } | 608 } |
| OLD | NEW |