| OLD | NEW |
| 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 21 matching lines...) Expand all Loading... |
| 32 TestSenderReceiver *theObj = static_cast<TestSenderReceiver *>(obj); | 32 TestSenderReceiver *theObj = static_cast<TestSenderReceiver *>(obj); |
| 33 | 33 |
| 34 return theObj->ProcLoop(); | 34 return theObj->ProcLoop(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 | 37 |
| 38 TestSenderReceiver::TestSenderReceiver (void) | 38 TestSenderReceiver::TestSenderReceiver (void) |
| 39 : | 39 : |
| 40 _critSect(CriticalSectionWrapper::CreateCriticalSection()), | 40 _critSect(CriticalSectionWrapper::CreateCriticalSection()), |
| 41 _eventPtr(NULL), | 41 _eventPtr(NULL), |
| 42 _procThread(ProcThreadFunction, this, "TestSenderReceiver"), |
| 42 _running(false), | 43 _running(false), |
| 43 _payloadType(0), | 44 _payloadType(0), |
| 44 _loadGenerator(NULL), | 45 _loadGenerator(NULL), |
| 45 _isSender(false), | 46 _isSender(false), |
| 46 _isReceiver(false), | 47 _isReceiver(false), |
| 47 _sendRecCB(NULL), | 48 _sendRecCB(NULL), |
| 48 _lastBytesReceived(0), | 49 _lastBytesReceived(0), |
| 49 _lastTime(-1) | 50 _lastTime(-1) |
| 50 { | 51 { |
| 51 // RTP/RTCP module | 52 // RTP/RTCP module |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 CriticalSectionScoped cs(_critSect); | 156 CriticalSectionScoped cs(_critSect); |
| 156 | 157 |
| 157 _eventPtr = EventWrapper::Create(); | 158 _eventPtr = EventWrapper::Create(); |
| 158 | 159 |
| 159 if (_rtp->SetSendingStatus(true) != 0) | 160 if (_rtp->SetSendingStatus(true) != 0) |
| 160 { | 161 { |
| 161 throw "_rtp->SetSendingStatus"; | 162 throw "_rtp->SetSendingStatus"; |
| 162 exit(1); | 163 exit(1); |
| 163 } | 164 } |
| 164 | 165 |
| 165 _procThread = PlatformThread::CreateThread(ProcThreadFunction, this, | |
| 166 "TestSenderReceiver"); | |
| 167 | |
| 168 _running = true; | 166 _running = true; |
| 169 | 167 |
| 170 if (_isReceiver) | 168 if (_isReceiver) |
| 171 { | 169 { |
| 172 if (_transport->StartReceiving(NR_OF_SOCKET_BUFFERS) != 0) | 170 if (_transport->StartReceiving(NR_OF_SOCKET_BUFFERS) != 0) |
| 173 { | 171 { |
| 174 throw "_transport->StartReceiving"; | 172 throw "_transport->StartReceiving"; |
| 175 exit(1); | 173 exit(1); |
| 176 } | 174 } |
| 177 } | 175 } |
| 178 | 176 |
| 179 _procThread->Start(); | 177 _procThread.Start(); |
| 180 _procThread->SetPriority(kRealtimePriority); | 178 _procThread.SetPriority(rtc::kRealtimePriority); |
| 181 | 179 |
| 182 return 0; | 180 return 0; |
| 183 | 181 |
| 184 } | 182 } |
| 185 | 183 |
| 186 | 184 |
| 187 int32_t TestSenderReceiver::Stop () | 185 int32_t TestSenderReceiver::Stop () |
| 188 { | 186 { |
| 189 CriticalSectionScoped cs(_critSect); | 187 CriticalSectionScoped cs(_critSect); |
| 190 | 188 |
| 191 _transport->StopReceiving(); | 189 _transport->StopReceiving(); |
| 192 | 190 |
| 193 if (_procThread) | 191 if (_running) |
| 194 { | 192 { |
| 195 _running = false; | 193 _running = false; |
| 196 _eventPtr->Set(); | 194 _eventPtr->Set(); |
| 197 | 195 |
| 198 _procThread->Stop(); | 196 _procThread.Stop(); |
| 199 _procThread.reset(); | |
| 200 | 197 |
| 201 delete _eventPtr; | 198 delete _eventPtr; |
| 202 } | 199 } |
| 203 | 200 |
| 204 return (0); | 201 return (0); |
| 205 } | 202 } |
| 206 | 203 |
| 207 | 204 |
| 208 bool TestSenderReceiver::ProcLoop(void) | 205 bool TestSenderReceiver::ProcLoop(void) |
| 209 { | 206 { |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 399 |
| 403 if (_sendRecCB) | 400 if (_sendRecCB) |
| 404 { | 401 { |
| 405 _sendRecCB->OnOnNetworkChanged(maxBitrateBps, | 402 _sendRecCB->OnOnNetworkChanged(maxBitrateBps, |
| 406 fractionLost, | 403 fractionLost, |
| 407 roundTripTimeMs, | 404 roundTripTimeMs, |
| 408 bwEstimateKbitMin, | 405 bwEstimateKbitMin, |
| 409 bwEstimateKbitMax); | 406 bwEstimateKbitMax); |
| 410 } | 407 } |
| 411 } | 408 } |
| OLD | NEW |