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

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

Issue 570713003: Avoid unsafe usage of CancelIo() within Windows SyncSocket. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix clients. Created 6 years, 3 months 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
« no previous file with comments | « content/browser/renderer_host/media/audio_sync_reader.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // Release the reference for the thread. Note that after this, the Thread 159 // Release the reference for the thread. Note that after this, the Thread
160 // instance will most likely be deleted. 160 // instance will most likely be deleted.
161 Release(); 161 Release();
162 } 162 }
163 163
164 void AudioDeviceThread::Thread::Run() { 164 void AudioDeviceThread::Thread::Run() {
165 uint32 buffer_index = 0; 165 uint32 buffer_index = 0;
166 while (true) { 166 while (true) {
167 int pending_data = 0; 167 int pending_data = 0;
168 size_t bytes_read = socket_.Receive(&pending_data, sizeof(pending_data)); 168 size_t bytes_read = socket_.Receive(&pending_data, sizeof(pending_data));
169 if (bytes_read != sizeof(pending_data)) { 169 if (bytes_read != sizeof(pending_data))
170 DCHECK_EQ(bytes_read, 0U);
171 break; 170 break;
172 }
173 171
174 { 172 {
175 base::AutoLock auto_lock(callback_lock_); 173 base::AutoLock auto_lock(callback_lock_);
176 if (callback_) 174 if (callback_)
177 callback_->Process(pending_data); 175 callback_->Process(pending_data);
178 } 176 }
179 177
180 // Let the other end know which buffer we just filled. The buffer index is 178 // Let the other end know which buffer we just filled. The buffer index is
181 // used to ensure the other end is getting the buffer it expects. For more 179 // used to ensure the other end is getting the buffer it expects. For more
182 // details on how this works see AudioSyncReader::WaitUntilDataIsReady(). 180 // details on how this works see AudioSyncReader::WaitUntilDataIsReady().
(...skipping 29 matching lines...) Expand all
212 } 210 }
213 211
214 AudioDeviceThread::Callback::~Callback() {} 212 AudioDeviceThread::Callback::~Callback() {}
215 213
216 void AudioDeviceThread::Callback::InitializeOnAudioThread() { 214 void AudioDeviceThread::Callback::InitializeOnAudioThread() {
217 MapSharedMemory(); 215 MapSharedMemory();
218 CHECK(shared_memory_.memory()); 216 CHECK(shared_memory_.memory());
219 } 217 }
220 218
221 } // namespace media. 219 } // namespace media.
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/audio_sync_reader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698