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 |
11 #include "webrtc/modules/audio_coding/main/test/APITest.h" | 11 #include "webrtc/modules/audio_coding/main/test/APITest.h" |
12 | 12 |
13 #include <ctype.h> | 13 #include <ctype.h> |
14 #include <stdio.h> | 14 #include <stdio.h> |
15 #include <stdlib.h> | 15 #include <stdlib.h> |
16 #include <string.h> | 16 #include <string.h> |
17 | 17 |
18 #include <iostream> | 18 #include <iostream> |
19 #include <ostream> | 19 #include <ostream> |
20 #include <string> | 20 #include <string> |
21 | 21 |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 #include "webrtc/base/platform_thread.h" |
23 #include "webrtc/common.h" | 24 #include "webrtc/common.h" |
24 #include "webrtc/common_types.h" | 25 #include "webrtc/common_types.h" |
25 #include "webrtc/engine_configurations.h" | 26 #include "webrtc/engine_configurations.h" |
26 #include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h" | 27 #include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h" |
27 #include "webrtc/modules/audio_coding/main/test/utility.h" | 28 #include "webrtc/modules/audio_coding/main/test/utility.h" |
28 #include "webrtc/system_wrappers/include/event_wrapper.h" | 29 #include "webrtc/system_wrappers/include/event_wrapper.h" |
29 #include "webrtc/system_wrappers/include/thread_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) \ | 39 #define CHECK_THREAD_NULLITY(myThread, S) \ |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 | 515 |
516 return true; | 516 return true; |
517 } | 517 } |
518 | 518 |
519 void APITest::Perform() { | 519 void APITest::Perform() { |
520 SetUp(); | 520 SetUp(); |
521 | 521 |
522 //--- THREADS | 522 //--- THREADS |
523 // A | 523 // A |
524 // PUSH | 524 // PUSH |
525 rtc::scoped_ptr<ThreadWrapper> myPushAudioThreadA = | 525 rtc::scoped_ptr<PlatformThread> myPushAudioThreadA = |
526 ThreadWrapper::CreateThread(PushAudioThreadA, this, "PushAudioThreadA"); | 526 PlatformThread::CreateThread(PushAudioThreadA, this, "PushAudioThreadA"); |
527 CHECK_THREAD_NULLITY(myPushAudioThreadA, "Unable to start A::PUSH thread"); | 527 CHECK_THREAD_NULLITY(myPushAudioThreadA, "Unable to start A::PUSH thread"); |
528 // PULL | 528 // PULL |
529 rtc::scoped_ptr<ThreadWrapper> myPullAudioThreadA = | 529 rtc::scoped_ptr<PlatformThread> myPullAudioThreadA = |
530 ThreadWrapper::CreateThread(PullAudioThreadA, this, "PullAudioThreadA"); | 530 PlatformThread::CreateThread(PullAudioThreadA, this, "PullAudioThreadA"); |
531 CHECK_THREAD_NULLITY(myPullAudioThreadA, "Unable to start A::PULL thread"); | 531 CHECK_THREAD_NULLITY(myPullAudioThreadA, "Unable to start A::PULL thread"); |
532 // Process | 532 // Process |
533 rtc::scoped_ptr<ThreadWrapper> myProcessThreadA = ThreadWrapper::CreateThread( | 533 rtc::scoped_ptr<PlatformThread> myProcessThreadA = |
534 ProcessThreadA, this, "ProcessThreadA"); | 534 PlatformThread::CreateThread(ProcessThreadA, this, "ProcessThreadA"); |
535 CHECK_THREAD_NULLITY(myProcessThreadA, "Unable to start A::Process thread"); | 535 CHECK_THREAD_NULLITY(myProcessThreadA, "Unable to start A::Process thread"); |
536 // API | 536 // API |
537 rtc::scoped_ptr<ThreadWrapper> myAPIThreadA = ThreadWrapper::CreateThread( | 537 rtc::scoped_ptr<PlatformThread> myAPIThreadA = |
538 APIThreadA, this, "APIThreadA"); | 538 PlatformThread::CreateThread(APIThreadA, this, "APIThreadA"); |
539 CHECK_THREAD_NULLITY(myAPIThreadA, "Unable to start A::API thread"); | 539 CHECK_THREAD_NULLITY(myAPIThreadA, "Unable to start A::API thread"); |
540 // B | 540 // B |
541 // PUSH | 541 // PUSH |
542 rtc::scoped_ptr<ThreadWrapper> myPushAudioThreadB = | 542 rtc::scoped_ptr<PlatformThread> myPushAudioThreadB = |
543 ThreadWrapper::CreateThread(PushAudioThreadB, this, "PushAudioThreadB"); | 543 PlatformThread::CreateThread(PushAudioThreadB, this, "PushAudioThreadB"); |
544 CHECK_THREAD_NULLITY(myPushAudioThreadB, "Unable to start B::PUSH thread"); | 544 CHECK_THREAD_NULLITY(myPushAudioThreadB, "Unable to start B::PUSH thread"); |
545 // PULL | 545 // PULL |
546 rtc::scoped_ptr<ThreadWrapper> myPullAudioThreadB = | 546 rtc::scoped_ptr<PlatformThread> myPullAudioThreadB = |
547 ThreadWrapper::CreateThread(PullAudioThreadB, this, "PullAudioThreadB"); | 547 PlatformThread::CreateThread(PullAudioThreadB, this, "PullAudioThreadB"); |
548 CHECK_THREAD_NULLITY(myPullAudioThreadB, "Unable to start B::PULL thread"); | 548 CHECK_THREAD_NULLITY(myPullAudioThreadB, "Unable to start B::PULL thread"); |
549 // Process | 549 // Process |
550 rtc::scoped_ptr<ThreadWrapper> myProcessThreadB = ThreadWrapper::CreateThread( | 550 rtc::scoped_ptr<PlatformThread> myProcessThreadB = |
551 ProcessThreadB, this, "ProcessThreadB"); | 551 PlatformThread::CreateThread(ProcessThreadB, this, "ProcessThreadB"); |
552 CHECK_THREAD_NULLITY(myProcessThreadB, "Unable to start B::Process thread"); | 552 CHECK_THREAD_NULLITY(myProcessThreadB, "Unable to start B::Process thread"); |
553 // API | 553 // API |
554 rtc::scoped_ptr<ThreadWrapper> myAPIThreadB = ThreadWrapper::CreateThread( | 554 rtc::scoped_ptr<PlatformThread> myAPIThreadB = |
555 APIThreadB, this, "APIThreadB"); | 555 PlatformThread::CreateThread(APIThreadB, this, "APIThreadB"); |
556 CHECK_THREAD_NULLITY(myAPIThreadB, "Unable to start B::API thread"); | 556 CHECK_THREAD_NULLITY(myAPIThreadB, "Unable to start B::API thread"); |
557 | 557 |
558 //_apiEventA->StartTimer(true, 5000); | 558 //_apiEventA->StartTimer(true, 5000); |
559 //_apiEventB->StartTimer(true, 5000); | 559 //_apiEventB->StartTimer(true, 5000); |
560 | 560 |
561 _processEventA->StartTimer(true, 10); | 561 _processEventA->StartTimer(true, 10); |
562 _processEventB->StartTimer(true, 10); | 562 _processEventB->StartTimer(true, 10); |
563 | 563 |
564 _pullEventA->StartTimer(true, 10); | 564 _pullEventA->StartTimer(true, 10); |
565 _pullEventB->StartTimer(true, 10); | 565 _pullEventB->StartTimer(true, 10); |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 CHECK_ERROR_MT(myACM->RegisterSendCodec(myCodec)); | 1105 CHECK_ERROR_MT(myACM->RegisterSendCodec(myCodec)); |
1106 myChannel->ResetStats(); | 1106 myChannel->ResetStats(); |
1107 { | 1107 { |
1108 WriteLockScoped wl(_apiTestRWLock); | 1108 WriteLockScoped wl(_apiTestRWLock); |
1109 *thereIsEncoder = true; | 1109 *thereIsEncoder = true; |
1110 } | 1110 } |
1111 Wait(500); | 1111 Wait(500); |
1112 } | 1112 } |
1113 | 1113 |
1114 } // namespace webrtc | 1114 } // namespace webrtc |
OLD | NEW |