OLD | NEW |
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 18 matching lines...) Expand all Loading... |
29 #include "webrtc/system_wrappers/include/event_wrapper.h" | 29 #include "webrtc/system_wrappers/include/event_wrapper.h" |
30 #include "webrtc/system_wrappers/include/tick_util.h" | 30 #include "webrtc/system_wrappers/include/tick_util.h" |
31 #include "webrtc/system_wrappers/include/trace.h" | 31 #include "webrtc/system_wrappers/include/trace.h" |
32 #include "webrtc/test/testsupport/fileutils.h" | 32 #include "webrtc/test/testsupport/fileutils.h" |
33 | 33 |
34 namespace webrtc { | 34 namespace webrtc { |
35 | 35 |
36 #define TEST_DURATION_SEC 600 | 36 #define TEST_DURATION_SEC 600 |
37 #define NUMBER_OF_SENDER_TESTS 6 | 37 #define NUMBER_OF_SENDER_TESTS 6 |
38 #define MAX_FILE_NAME_LENGTH_BYTE 500 | 38 #define MAX_FILE_NAME_LENGTH_BYTE 500 |
39 #define CHECK_THREAD_NULLITY(myThread, S) \ | |
40 if(myThread != NULL) { \ | |
41 (myThread)->Start(); \ | |
42 } else { \ | |
43 ADD_FAILURE() << S; \ | |
44 } | |
45 | 39 |
46 void APITest::Wait(uint32_t waitLengthMs) { | 40 void APITest::Wait(uint32_t waitLengthMs) { |
47 if (_randomTest) { | 41 if (_randomTest) { |
48 return; | 42 return; |
49 } else { | 43 } else { |
50 EventWrapper* myEvent = EventWrapper::Create(); | 44 EventWrapper* myEvent = EventWrapper::Create(); |
51 myEvent->Wait(waitLengthMs); | 45 myEvent->Wait(waitLengthMs); |
52 delete myEvent; | 46 delete myEvent; |
53 return; | 47 return; |
54 } | 48 } |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 | 509 |
516 return true; | 510 return true; |
517 } | 511 } |
518 | 512 |
519 void APITest::Perform() { | 513 void APITest::Perform() { |
520 SetUp(); | 514 SetUp(); |
521 | 515 |
522 //--- THREADS | 516 //--- THREADS |
523 // A | 517 // A |
524 // PUSH | 518 // PUSH |
525 rtc::scoped_ptr<PlatformThread> myPushAudioThreadA = | 519 rtc::PlatformThread myPushAudioThreadA(PushAudioThreadA, this, |
526 PlatformThread::CreateThread(PushAudioThreadA, this, "PushAudioThreadA"); | 520 "PushAudioThreadA"); |
527 CHECK_THREAD_NULLITY(myPushAudioThreadA, "Unable to start A::PUSH thread"); | 521 myPushAudioThreadA.Start(); |
528 // PULL | 522 // PULL |
529 rtc::scoped_ptr<PlatformThread> myPullAudioThreadA = | 523 rtc::PlatformThread myPullAudioThreadA(PullAudioThreadA, this, |
530 PlatformThread::CreateThread(PullAudioThreadA, this, "PullAudioThreadA"); | 524 "PullAudioThreadA"); |
531 CHECK_THREAD_NULLITY(myPullAudioThreadA, "Unable to start A::PULL thread"); | 525 myPullAudioThreadA.Start(); |
532 // Process | 526 // Process |
533 rtc::scoped_ptr<PlatformThread> myProcessThreadA = | 527 rtc::PlatformThread myProcessThreadA(ProcessThreadA, this, "ProcessThreadA"); |
534 PlatformThread::CreateThread(ProcessThreadA, this, "ProcessThreadA"); | 528 myProcessThreadA.Start(); |
535 CHECK_THREAD_NULLITY(myProcessThreadA, "Unable to start A::Process thread"); | |
536 // API | 529 // API |
537 rtc::scoped_ptr<PlatformThread> myAPIThreadA = | 530 rtc::PlatformThread myAPIThreadA(APIThreadA, this, "APIThreadA"); |
538 PlatformThread::CreateThread(APIThreadA, this, "APIThreadA"); | 531 myAPIThreadA.Start(); |
539 CHECK_THREAD_NULLITY(myAPIThreadA, "Unable to start A::API thread"); | |
540 // B | 532 // B |
541 // PUSH | 533 // PUSH |
542 rtc::scoped_ptr<PlatformThread> myPushAudioThreadB = | 534 rtc::PlatformThread myPushAudioThreadB(PushAudioThreadB, this, |
543 PlatformThread::CreateThread(PushAudioThreadB, this, "PushAudioThreadB"); | 535 "PushAudioThreadB"); |
544 CHECK_THREAD_NULLITY(myPushAudioThreadB, "Unable to start B::PUSH thread"); | 536 myPushAudioThreadB.Start(); |
545 // PULL | 537 // PULL |
546 rtc::scoped_ptr<PlatformThread> myPullAudioThreadB = | 538 rtc::PlatformThread myPullAudioThreadB(PullAudioThreadB, this, |
547 PlatformThread::CreateThread(PullAudioThreadB, this, "PullAudioThreadB"); | 539 "PullAudioThreadB"); |
548 CHECK_THREAD_NULLITY(myPullAudioThreadB, "Unable to start B::PULL thread"); | 540 myPullAudioThreadB.Start(); |
549 // Process | 541 // Process |
550 rtc::scoped_ptr<PlatformThread> myProcessThreadB = | 542 rtc::PlatformThread myProcessThreadB(ProcessThreadB, this, "ProcessThreadB"); |
551 PlatformThread::CreateThread(ProcessThreadB, this, "ProcessThreadB"); | 543 myProcessThreadB.Start(); |
552 CHECK_THREAD_NULLITY(myProcessThreadB, "Unable to start B::Process thread"); | |
553 // API | 544 // API |
554 rtc::scoped_ptr<PlatformThread> myAPIThreadB = | 545 rtc::PlatformThread myAPIThreadB(APIThreadB, this, "APIThreadB"); |
555 PlatformThread::CreateThread(APIThreadB, this, "APIThreadB"); | 546 myAPIThreadB.Start(); |
556 CHECK_THREAD_NULLITY(myAPIThreadB, "Unable to start B::API thread"); | |
557 | 547 |
558 //_apiEventA->StartTimer(true, 5000); | 548 //_apiEventA->StartTimer(true, 5000); |
559 //_apiEventB->StartTimer(true, 5000); | 549 //_apiEventB->StartTimer(true, 5000); |
560 | 550 |
561 _processEventA->StartTimer(true, 10); | 551 _processEventA->StartTimer(true, 10); |
562 _processEventB->StartTimer(true, 10); | 552 _processEventB->StartTimer(true, 10); |
563 | 553 |
564 _pullEventA->StartTimer(true, 10); | 554 _pullEventA->StartTimer(true, 10); |
565 _pullEventB->StartTimer(true, 10); | 555 _pullEventB->StartTimer(true, 10); |
566 | 556 |
(...skipping 13 matching lines...) Expand all Loading... |
580 } | 570 } |
581 //fflush(stderr); | 571 //fflush(stderr); |
582 completeEvent->Wait(50); | 572 completeEvent->Wait(50); |
583 currentTime = TickTime::MillisecondTimestamp(); | 573 currentTime = TickTime::MillisecondTimestamp(); |
584 } while ((currentTime - startTime) < 120000); | 574 } while ((currentTime - startTime) < 120000); |
585 | 575 |
586 //completeEvent->Wait(0xFFFFFFFF); | 576 //completeEvent->Wait(0xFFFFFFFF); |
587 //(unsigned long)((unsigned long)TEST_DURATION_SEC * (unsigned long)1000)); | 577 //(unsigned long)((unsigned long)TEST_DURATION_SEC * (unsigned long)1000)); |
588 delete completeEvent; | 578 delete completeEvent; |
589 | 579 |
590 myPushAudioThreadA->Stop(); | 580 myPushAudioThreadA.Stop(); |
591 myPullAudioThreadA->Stop(); | 581 myPullAudioThreadA.Stop(); |
592 myProcessThreadA->Stop(); | 582 myProcessThreadA.Stop(); |
593 myAPIThreadA->Stop(); | 583 myAPIThreadA.Stop(); |
594 | 584 |
595 myPushAudioThreadB->Stop(); | 585 myPushAudioThreadB.Stop(); |
596 myPullAudioThreadB->Stop(); | 586 myPullAudioThreadB.Stop(); |
597 myProcessThreadB->Stop(); | 587 myProcessThreadB.Stop(); |
598 myAPIThreadB->Stop(); | 588 myAPIThreadB.Stop(); |
599 } | 589 } |
600 | 590 |
601 void APITest::CheckVADStatus(char side) { | 591 void APITest::CheckVADStatus(char side) { |
602 | 592 |
603 bool dtxEnabled; | 593 bool dtxEnabled; |
604 bool vadEnabled; | 594 bool vadEnabled; |
605 ACMVADMode vadMode; | 595 ACMVADMode vadMode; |
606 | 596 |
607 if (side == 'A') { | 597 if (side == 'A') { |
608 _acmA->VAD(&dtxEnabled, &vadEnabled, &vadMode); | 598 _acmA->VAD(&dtxEnabled, &vadEnabled, &vadMode); |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 CHECK_ERROR_MT(myACM->RegisterSendCodec(myCodec)); | 1095 CHECK_ERROR_MT(myACM->RegisterSendCodec(myCodec)); |
1106 myChannel->ResetStats(); | 1096 myChannel->ResetStats(); |
1107 { | 1097 { |
1108 WriteLockScoped wl(_apiTestRWLock); | 1098 WriteLockScoped wl(_apiTestRWLock); |
1109 *thereIsEncoder = true; | 1099 *thereIsEncoder = true; |
1110 } | 1100 } |
1111 Wait(500); | 1101 Wait(500); |
1112 } | 1102 } |
1113 | 1103 |
1114 } // namespace webrtc | 1104 } // namespace webrtc |
OLD | NEW |