OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2008 Google Inc. | 3 * Copyright 2008 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 10 matching lines...) Expand all Loading... |
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | 22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #include "talk/app/webrtc/mediacontroller.h" | 28 #include "talk/app/webrtc/mediacontroller.h" |
29 #include "talk/media/base/fakecapturemanager.h" | 29 #include "talk/media/base/fakecapturemanager.h" |
30 #include "talk/media/base/fakemediaengine.h" | 30 #include "talk/media/base/fakemediaengine.h" |
31 #include "talk/media/base/fakemediaprocessor.h" | |
32 #include "talk/media/base/testutils.h" | 31 #include "talk/media/base/testutils.h" |
33 #include "talk/media/devices/fakedevicemanager.h" | 32 #include "talk/media/devices/fakedevicemanager.h" |
34 #include "talk/media/webrtc/fakewebrtccall.h" | 33 #include "talk/media/webrtc/fakewebrtccall.h" |
35 #include "webrtc/p2p/base/fakesession.h" | 34 #include "webrtc/p2p/base/fakesession.h" |
36 #include "talk/session/media/channelmanager.h" | 35 #include "talk/session/media/channelmanager.h" |
37 #include "webrtc/base/gunit.h" | 36 #include "webrtc/base/gunit.h" |
38 #include "webrtc/base/logging.h" | 37 #include "webrtc/base/logging.h" |
39 #include "webrtc/base/thread.h" | 38 #include "webrtc/base/thread.h" |
40 | 39 |
41 namespace cricket { | 40 namespace cricket { |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 TEST_F(ChannelManagerTest, SetLogging) { | 521 TEST_F(ChannelManagerTest, SetLogging) { |
523 EXPECT_TRUE(cm_->Init()); | 522 EXPECT_TRUE(cm_->Init()); |
524 cm_->SetVoiceLogging(rtc::LS_INFO, "test-voice"); | 523 cm_->SetVoiceLogging(rtc::LS_INFO, "test-voice"); |
525 cm_->SetVideoLogging(rtc::LS_VERBOSE, "test-video"); | 524 cm_->SetVideoLogging(rtc::LS_VERBOSE, "test-video"); |
526 EXPECT_EQ(rtc::LS_INFO, fme_->voice_loglevel()); | 525 EXPECT_EQ(rtc::LS_INFO, fme_->voice_loglevel()); |
527 EXPECT_STREQ("test-voice", fme_->voice_logfilter().c_str()); | 526 EXPECT_STREQ("test-voice", fme_->voice_logfilter().c_str()); |
528 EXPECT_EQ(rtc::LS_VERBOSE, fme_->video_loglevel()); | 527 EXPECT_EQ(rtc::LS_VERBOSE, fme_->video_loglevel()); |
529 EXPECT_STREQ("test-video", fme_->video_logfilter().c_str()); | 528 EXPECT_STREQ("test-video", fme_->video_logfilter().c_str()); |
530 } | 529 } |
531 | 530 |
532 // Test that the Video/Voice Processors register and unregister | |
533 TEST_F(ChannelManagerTest, RegisterProcessors) { | |
534 cricket::FakeMediaProcessor fmp; | |
535 EXPECT_TRUE(cm_->Init()); | |
536 EXPECT_FALSE(fme_->voice_processor_registered(cricket::MPD_TX)); | |
537 EXPECT_FALSE(fme_->voice_processor_registered(cricket::MPD_RX)); | |
538 | |
539 EXPECT_FALSE(fme_->voice_processor_registered(cricket::MPD_TX)); | |
540 EXPECT_FALSE(fme_->voice_processor_registered(cricket::MPD_RX)); | |
541 | |
542 EXPECT_FALSE(fme_->voice_processor_registered(cricket::MPD_TX)); | |
543 EXPECT_FALSE(fme_->voice_processor_registered(cricket::MPD_RX)); | |
544 | |
545 EXPECT_TRUE(cm_->RegisterVoiceProcessor(1, | |
546 &fmp, | |
547 cricket::MPD_RX)); | |
548 EXPECT_FALSE(fme_->voice_processor_registered(cricket::MPD_TX)); | |
549 EXPECT_TRUE(fme_->voice_processor_registered(cricket::MPD_RX)); | |
550 | |
551 | |
552 EXPECT_TRUE(cm_->UnregisterVoiceProcessor(1, | |
553 &fmp, | |
554 cricket::MPD_RX)); | |
555 EXPECT_FALSE(fme_->voice_processor_registered(cricket::MPD_TX)); | |
556 EXPECT_FALSE(fme_->voice_processor_registered(cricket::MPD_RX)); | |
557 | |
558 EXPECT_TRUE(cm_->RegisterVoiceProcessor(1, | |
559 &fmp, | |
560 cricket::MPD_TX)); | |
561 EXPECT_TRUE(fme_->voice_processor_registered(cricket::MPD_TX)); | |
562 EXPECT_FALSE(fme_->voice_processor_registered(cricket::MPD_RX)); | |
563 | |
564 EXPECT_TRUE(cm_->UnregisterVoiceProcessor(1, | |
565 &fmp, | |
566 cricket::MPD_TX)); | |
567 EXPECT_FALSE(fme_->voice_processor_registered(cricket::MPD_TX)); | |
568 EXPECT_FALSE(fme_->voice_processor_registered(cricket::MPD_RX)); | |
569 } | |
570 | |
571 TEST_F(ChannelManagerTest, SetVideoRtxEnabled) { | 531 TEST_F(ChannelManagerTest, SetVideoRtxEnabled) { |
572 std::vector<VideoCodec> codecs; | 532 std::vector<VideoCodec> codecs; |
573 const VideoCodec rtx_codec(96, "rtx", 0, 0, 0, 0); | 533 const VideoCodec rtx_codec(96, "rtx", 0, 0, 0, 0); |
574 | 534 |
575 // By default RTX is disabled. | 535 // By default RTX is disabled. |
576 cm_->GetSupportedVideoCodecs(&codecs); | 536 cm_->GetSupportedVideoCodecs(&codecs); |
577 EXPECT_FALSE(ContainsMatchingCodec(codecs, rtx_codec)); | 537 EXPECT_FALSE(ContainsMatchingCodec(codecs, rtx_codec)); |
578 | 538 |
579 // Enable and check. | 539 // Enable and check. |
580 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); | 540 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); |
(...skipping 11 matching lines...) Expand all Loading... |
592 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); | 552 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); |
593 | 553 |
594 // Can set again after terminate. | 554 // Can set again after terminate. |
595 cm_->Terminate(); | 555 cm_->Terminate(); |
596 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); | 556 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); |
597 cm_->GetSupportedVideoCodecs(&codecs); | 557 cm_->GetSupportedVideoCodecs(&codecs); |
598 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); | 558 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); |
599 } | 559 } |
600 | 560 |
601 } // namespace cricket | 561 } // namespace cricket |
OLD | NEW |