Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(745)

Side by Side Diff: media/audio/audio_device_thread.cc

Issue 1487983002: Forward the number of skipped frames by the OS in audio playout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review fixes, compile fixes, rebase. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_device_thread.h" 5 #include "media/audio/audio_device_thread.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 Run(); 161 Run();
162 162
163 // Release the reference for the thread. Note that after this, the Thread 163 // Release the reference for the thread. Note that after this, the Thread
164 // instance will most likely be deleted. 164 // instance will most likely be deleted.
165 Release(); 165 Release();
166 } 166 }
167 167
168 void AudioDeviceThread::Thread::Run() { 168 void AudioDeviceThread::Thread::Run() {
169 uint32_t buffer_index = 0; 169 uint32_t buffer_index = 0;
170 while (true) { 170 while (true) {
171 uint32_t pending_data = 0; 171 uint32 pending_data = 0;
172 size_t bytes_read = socket_.Receive(&pending_data, sizeof(pending_data)); 172 size_t bytes_read = socket_.Receive(&pending_data, sizeof(pending_data));
173 if (bytes_read != sizeof(pending_data)) 173 if (bytes_read != sizeof(pending_data))
174 break; 174 break;
175 175
176 // std::numeric_limits<uint32_t>::max() is a special signal which is 176 // std::numeric_limits<uint32_t>::max() is a special signal which is
177 // returned after the browser stops the output device in response to a 177 // returned after the browser
178 // renderer side request. 178 // stops the output device in response to a renderer side request.
179 // 179 //
180 // Avoid running Process() for the paused signal, we still need to update 180 // Avoid running Process() for the paused signal, we still need to update
181 // the buffer index if |synchronized_buffers_| is true though. 181 // the buffer index if |synchronized_buffers_| is true though.
182 // 182 //
183 // See comments in AudioOutputController::DoPause() for details on why. 183 // See comments in AudioOutputController::DoPause() for details on why.
184 if (pending_data != std::numeric_limits<uint32_t>::max()) { 184 if (pending_data != std::numeric_limits<uint32_t>::max()) {
185 base::AutoLock auto_lock(callback_lock_); 185 base::AutoLock auto_lock(callback_lock_);
186 if (callback_) 186 if (callback_)
187 callback_->Process(pending_data); 187 callback_->Process(pending_data);
188 } 188 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } 229 }
230 230
231 AudioDeviceThread::Callback::~Callback() {} 231 AudioDeviceThread::Callback::~Callback() {}
232 232
233 void AudioDeviceThread::Callback::InitializeOnAudioThread() { 233 void AudioDeviceThread::Callback::InitializeOnAudioThread() {
234 MapSharedMemory(); 234 MapSharedMemory();
235 CHECK(shared_memory_.memory()); 235 CHECK(shared_memory_.memory());
236 } 236 }
237 237
238 } // namespace media. 238 } // namespace media.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698