OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2009 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 const cricket::AudioCodec kIsacCodec(103, "ISAC", 40000, 16000, 1); | 43 const cricket::AudioCodec kIsacCodec(103, "ISAC", 40000, 16000, 1); |
44 const cricket::VideoCodec kH264Codec(97, "H264"); | 44 const cricket::VideoCodec kH264Codec(97, "H264"); |
45 const cricket::VideoCodec kH264SvcCodec(99, "H264-SVC"); | 45 const cricket::VideoCodec kH264SvcCodec(99, "H264-SVC"); |
46 const cricket::DataCodec kGoogleDataCodec(101, "google-data"); | 46 const cricket::DataCodec kGoogleDataCodec(101, "google-data"); |
47 const uint32_t kSsrc1 = 0x1111; | 47 const uint32_t kSsrc1 = 0x1111; |
48 const uint32_t kSsrc2 = 0x2222; | 48 const uint32_t kSsrc2 = 0x2222; |
49 const uint32_t kSsrc3 = 0x3333; | 49 const uint32_t kSsrc3 = 0x3333; |
50 const int kAudioPts[] = {0, 8}; | 50 const int kAudioPts[] = {0, 8}; |
51 const int kVideoPts[] = {97, 99}; | 51 const int kVideoPts[] = {97, 99}; |
52 enum class NetworkIsWorker { Yes, No }; | 52 enum class NetworkIsWorker { Yes, No }; |
| 53 const int kDefaultTimeout = 10000; // 10 seconds. |
53 } // namespace | 54 } // namespace |
54 | 55 |
55 template <class ChannelT, | 56 template <class ChannelT, |
56 class MediaChannelT, | 57 class MediaChannelT, |
57 class ContentT, | 58 class ContentT, |
58 class CodecT, | 59 class CodecT, |
59 class MediaInfoT, | 60 class MediaInfoT, |
60 class OptionsT> | 61 class OptionsT> |
61 class Traits { | 62 class Traits { |
62 public: | 63 public: |
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 EXPECT_TRUE(CheckNoRtcp2()); | 1589 EXPECT_TRUE(CheckNoRtcp2()); |
1589 | 1590 |
1590 SendCustomRtcp1(kSsrc2); | 1591 SendCustomRtcp1(kSsrc2); |
1591 SendCustomRtcp2(kSsrc1); | 1592 SendCustomRtcp2(kSsrc1); |
1592 WaitForThreads(); | 1593 WaitForThreads(); |
1593 // Bundle filter shouldn't filter out any RTCP. | 1594 // Bundle filter shouldn't filter out any RTCP. |
1594 EXPECT_TRUE(CheckCustomRtcp1(kSsrc1)); | 1595 EXPECT_TRUE(CheckCustomRtcp1(kSsrc1)); |
1595 EXPECT_TRUE(CheckCustomRtcp2(kSsrc2)); | 1596 EXPECT_TRUE(CheckCustomRtcp2(kSsrc2)); |
1596 } | 1597 } |
1597 | 1598 |
1598 // Test that the media monitor can be run and gives timely callbacks. | 1599 // Test that the media monitor can be run and gives callbacks. |
1599 void TestMediaMonitor() { | 1600 void TestMediaMonitor() { |
1600 static const int kTimeout = 500; | |
1601 CreateChannels(0, 0); | 1601 CreateChannels(0, 0); |
1602 EXPECT_TRUE(SendInitiate()); | 1602 EXPECT_TRUE(SendInitiate()); |
1603 EXPECT_TRUE(SendAccept()); | 1603 EXPECT_TRUE(SendAccept()); |
1604 channel1_->StartMediaMonitor(100); | 1604 channel1_->StartMediaMonitor(100); |
1605 channel2_->StartMediaMonitor(100); | 1605 channel2_->StartMediaMonitor(100); |
1606 // Ensure we get callbacks and stop. | 1606 // Ensure we get callbacks and stop. |
1607 EXPECT_TRUE_WAIT(media_info_callbacks1_ > 0, kTimeout); | 1607 EXPECT_TRUE_WAIT(media_info_callbacks1_ > 0, kDefaultTimeout); |
1608 EXPECT_TRUE_WAIT(media_info_callbacks2_ > 0, kTimeout); | 1608 EXPECT_TRUE_WAIT(media_info_callbacks2_ > 0, kDefaultTimeout); |
1609 channel1_->StopMediaMonitor(); | 1609 channel1_->StopMediaMonitor(); |
1610 channel2_->StopMediaMonitor(); | 1610 channel2_->StopMediaMonitor(); |
1611 // Ensure a restart of a stopped monitor works. | 1611 // Ensure a restart of a stopped monitor works. |
1612 channel1_->StartMediaMonitor(100); | 1612 channel1_->StartMediaMonitor(100); |
1613 EXPECT_TRUE_WAIT(media_info_callbacks1_ > 0, kTimeout); | 1613 EXPECT_TRUE_WAIT(media_info_callbacks1_ > 0, kDefaultTimeout); |
1614 channel1_->StopMediaMonitor(); | 1614 channel1_->StopMediaMonitor(); |
1615 // Ensure stopping a stopped monitor is OK. | 1615 // Ensure stopping a stopped monitor is OK. |
1616 channel1_->StopMediaMonitor(); | 1616 channel1_->StopMediaMonitor(); |
1617 } | 1617 } |
1618 | 1618 |
1619 void TestSetContentFailure() { | 1619 void TestSetContentFailure() { |
1620 CreateChannels(0, 0); | 1620 CreateChannels(0, 0); |
1621 | 1621 |
1622 auto sdesc = cricket::SessionDescription(); | 1622 auto sdesc = cricket::SessionDescription(); |
1623 sdesc.AddContent(cricket::CN_AUDIO, cricket::NS_JINGLE_RTP, | 1623 sdesc.AddContent(cricket::CN_AUDIO, cricket::NS_JINGLE_RTP, |
(...skipping 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3678 }; | 3678 }; |
3679 rtc::CopyOnWriteBuffer payload(data, 3); | 3679 rtc::CopyOnWriteBuffer payload(data, 3); |
3680 cricket::SendDataResult result; | 3680 cricket::SendDataResult result; |
3681 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); | 3681 ASSERT_TRUE(media_channel1_->SendData(params, payload, &result)); |
3682 EXPECT_EQ(params.ssrc, | 3682 EXPECT_EQ(params.ssrc, |
3683 media_channel1_->last_sent_data_params().ssrc); | 3683 media_channel1_->last_sent_data_params().ssrc); |
3684 EXPECT_EQ("foo", media_channel1_->last_sent_data()); | 3684 EXPECT_EQ("foo", media_channel1_->last_sent_data()); |
3685 } | 3685 } |
3686 | 3686 |
3687 // TODO(pthatcher): TestSetReceiver? | 3687 // TODO(pthatcher): TestSetReceiver? |
OLD | NEW |