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

Side by Side Diff: webrtc/modules/rtp_rtcp/test/BWEStandAlone/TestLoadGenerator.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) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 return _bitrateKbps; 69 return _bitrateKbps;
70 } 70 }
71 71
72 72
73 int32_t TestLoadGenerator::Start (const char *threadName) 73 int32_t TestLoadGenerator::Start (const char *threadName)
74 { 74 {
75 CriticalSectionScoped cs(_critSect); 75 CriticalSectionScoped cs(_critSect);
76 76
77 _eventPtr = EventWrapper::Create(); 77 _eventPtr = EventWrapper::Create();
78 78
79 _genThread = 79 _genThread.reset(
80 PlatformThread::CreateThread(SenderThreadFunction, this, threadName); 80 new rtc::PlatformThread(SenderThreadFunction, this, threadName));
81 _running = true; 81 _running = true;
82 82
83 _genThread->Start(); 83 _genThread->Start();
84 _genThread->SetPriority(kRealtimePriority); 84 _genThread->SetPriority(rtc::kRealtimePriority);
85 85
86 return 0; 86 return 0;
87 } 87 }
88 88
89 89
90 int32_t TestLoadGenerator::Stop () 90 int32_t TestLoadGenerator::Stop ()
91 { 91 {
92 _critSect.Enter(); 92 _critSect.Enter();
93 93
94 if (_genThread) 94 if (_genThread)
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 //printf("keep\n"); 423 //printf("keep\n");
424 const double periodMs = 1000.0 / _frameRateFps; 424 const double periodMs = 1000.0 / _frameRateFps;
425 size_t frameSize = 425 size_t frameSize =
426 static_cast<size_t>(_bitrateKbps * periodMs / 8 + 0.5); 426 static_cast<size_t>(_bitrateKbps * periodMs / 8 + 0.5);
427 frameSize = 427 frameSize =
428 std::max(frameSize, static_cast<size_t>(300 * periodMs / 8 + 0.5)); 428 std::max(frameSize, static_cast<size_t>(300 * periodMs / 8 + 0.5));
429 _accBits += frameSize * 8; 429 _accBits += frameSize * 8;
430 return frameSize; 430 return frameSize;
431 } 431 }
432 } 432 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698