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

Side by Side Diff: webrtc/modules/video_render/windows/video_render_direct3d9.cc

Issue 1476453002: Clean up PlatformThread. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: IsRunning DCHECK 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 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 _d3dZorder(), 287 _d3dZorder(),
288 _screenUpdateEvent(NULL), 288 _screenUpdateEvent(NULL),
289 _logoLeft(0), 289 _logoLeft(0),
290 _logoTop(0), 290 _logoTop(0),
291 _logoRight(0), 291 _logoRight(0),
292 _logoBottom(0), 292 _logoBottom(0),
293 _pd3dSurface(NULL), 293 _pd3dSurface(NULL),
294 _totalMemory(0), 294 _totalMemory(0),
295 _availableMemory(0) 295 _availableMemory(0)
296 { 296 {
297 _screenUpdateThread = PlatformThread::CreateThread( 297 _screenUpdateThread.reset(new rtc::PlatformThread(
298 ScreenUpdateThreadProc, this, "ScreenUpdateThread"); 298 ScreenUpdateThreadProc, this, "ScreenUpdateThread"));
299 _screenUpdateEvent = EventTimerWrapper::Create(); 299 _screenUpdateEvent = EventTimerWrapper::Create();
300 SetRect(&_originalHwndRect, 0, 0, 0, 0); 300 SetRect(&_originalHwndRect, 0, 0, 0, 0);
301 } 301 }
302 302
303 VideoRenderDirect3D9::~VideoRenderDirect3D9() 303 VideoRenderDirect3D9::~VideoRenderDirect3D9()
304 { 304 {
305 //NOTE: we should not enter CriticalSection in here! 305 //NOTE: we should not enter CriticalSection in here!
306 306
307 // Signal event to exit thread, then delete it 307 // Signal event to exit thread, then delete it
308 PlatformThread* tmpPtr = _screenUpdateThread.release(); 308 rtc::PlatformThread* tmpPtr = _screenUpdateThread.release();
309 if (tmpPtr) 309 if (tmpPtr)
310 { 310 {
311 _screenUpdateEvent->Set(); 311 _screenUpdateEvent->Set();
312 _screenUpdateEvent->StopTimer(); 312 _screenUpdateEvent->StopTimer();
313 313
314 tmpPtr->Stop(); 314 tmpPtr->Stop();
315 delete tmpPtr; 315 delete tmpPtr;
316 } 316 }
317 delete _screenUpdateEvent; 317 delete _screenUpdateEvent;
318 318
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 539
540 CriticalSectionScoped cs(&_refD3DCritsect); 540 CriticalSectionScoped cs(&_refD3DCritsect);
541 541
542 // Start rendering thread... 542 // Start rendering thread...
543 if (!_screenUpdateThread) 543 if (!_screenUpdateThread)
544 { 544 {
545 WEBRTC_TRACE(kTraceError, kTraceVideo, -1, "Thread not created"); 545 WEBRTC_TRACE(kTraceError, kTraceVideo, -1, "Thread not created");
546 return -1; 546 return -1;
547 } 547 }
548 _screenUpdateThread->Start(); 548 _screenUpdateThread->Start();
549 _screenUpdateThread->SetPriority(kRealtimePriority); 549 _screenUpdateThread->SetPriority(rtc::kRealtimePriority);
550 550
551 // Start the event triggering the render process 551 // Start the event triggering the render process
552 unsigned int monitorFreq = 60; 552 unsigned int monitorFreq = 60;
553 DEVMODE dm; 553 DEVMODE dm;
554 // initialize the DEVMODE structure 554 // initialize the DEVMODE structure
555 ZeroMemory(&dm, sizeof(dm)); 555 ZeroMemory(&dm, sizeof(dm));
556 dm.dmSize = sizeof(dm); 556 dm.dmSize = sizeof(dm);
557 if (0 != EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm)) 557 if (0 != EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm))
558 { 558 {
559 monitorFreq = dm.dmDisplayFrequency; 559 monitorFreq = dm.dmDisplayFrequency;
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 "Direct3D render failed to find channel"); 1157 "Direct3D render failed to find channel");
1158 return -1; 1158 return -1;
1159 } 1159 }
1160 // Only allow one stream per channel, demuxing is 1160 // Only allow one stream per channel, demuxing is
1161 ddobj->SetStreamSettings(0, zOrder, left, top, right, bottom); 1161 ddobj->SetStreamSettings(0, zOrder, left, top, right, bottom);
1162 1162
1163 return 0; 1163 return 0;
1164 } 1164 }
1165 1165
1166 } // namespace webrtc 1166 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_render/windows/video_render_direct3d9.h ('k') | webrtc/system_wrappers/include/data_log_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698