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 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1861 // Test that we can add and remove send streams. | 1861 // Test that we can add and remove send streams. |
1862 TEST_F(WebRtcVoiceEngineTestFake, CreateAndDeleteMultipleSendStreams) { | 1862 TEST_F(WebRtcVoiceEngineTestFake, CreateAndDeleteMultipleSendStreams) { |
1863 SetupForMultiSendStream(); | 1863 SetupForMultiSendStream(); |
1864 | 1864 |
1865 static const uint32_t kSsrcs4[] = {1, 2, 3, 4}; | 1865 static const uint32_t kSsrcs4[] = {1, 2, 3, 4}; |
1866 | 1866 |
1867 // Set the global state for sending. | 1867 // Set the global state for sending. |
1868 EXPECT_TRUE(channel_->SetSend(cricket::SEND_MICROPHONE)); | 1868 EXPECT_TRUE(channel_->SetSend(cricket::SEND_MICROPHONE)); |
1869 | 1869 |
1870 for (unsigned int i = 0; i < ARRAY_SIZE(kSsrcs4); ++i) { | 1870 for (unsigned int i = 0; i < ARRAY_SIZE(kSsrcs4); ++i) { |
1871 uint32_t ssrc = kSsrcs4[i]; | |
1872 | |
1871 EXPECT_TRUE(channel_->AddSendStream( | 1873 EXPECT_TRUE(channel_->AddSendStream( |
1872 cricket::StreamParams::CreateLegacy(kSsrcs4[i]))); | 1874 cricket::StreamParams::CreateLegacy(ssrc))); |
1875 EXPECT_NE(nullptr, call_.GetAudioSendStream(ssrc)); | |
1873 | 1876 |
1874 // Verify that we are in a sending state for all the created streams. | 1877 // Verify that we are in a sending state for all the created streams. |
1875 int channel_num = voe_.GetChannelFromLocalSsrc(kSsrcs4[i]); | 1878 int channel_num = voe_.GetChannelFromLocalSsrc(ssrc); |
1876 EXPECT_TRUE(voe_.GetSend(channel_num)); | 1879 EXPECT_TRUE(voe_.GetSend(channel_num)); |
1877 } | 1880 } |
1881 EXPECT_EQ(ARRAY_SIZE(kSsrcs4), call_.GetAudioSendStreams().size()); | |
1878 | 1882 |
1879 // Remove the first send channel, which is the default channel. It will only | 1883 // Delete the send streams. |
1880 // recycle the default channel but not delete it. | 1884 for (unsigned int i = 0; i < ARRAY_SIZE(kSsrcs4); ++i) { |
1881 EXPECT_TRUE(channel_->RemoveSendStream(kSsrcs4[0])); | 1885 uint32_t ssrc = kSsrcs4[i]; |
kwiberg-webrtc
2015/10/21 14:04:40
for (uint32_t ssrc : kSsrcs4)
the sun
2015/10/21 14:42:24
Thanks!
| |
1882 // Stream should already be Removed from the send stream list. | |
1883 EXPECT_FALSE(channel_->RemoveSendStream(kSsrcs4[0])); | |
1884 | 1886 |
1885 // Delete the rest of send channel streams. | 1887 EXPECT_TRUE(channel_->RemoveSendStream(ssrc)); |
1886 for (unsigned int i = 1; i < ARRAY_SIZE(kSsrcs4); ++i) { | 1888 EXPECT_EQ(nullptr, call_.GetAudioSendStream(ssrc)); |
1887 EXPECT_TRUE(channel_->RemoveSendStream(kSsrcs4[i])); | |
1888 // Stream should already be deleted. | 1889 // Stream should already be deleted. |
1889 EXPECT_FALSE(channel_->RemoveSendStream(kSsrcs4[i])); | 1890 EXPECT_FALSE(channel_->RemoveSendStream(ssrc)); |
1890 EXPECT_EQ(-1, voe_.GetChannelFromLocalSsrc(kSsrcs4[i])); | 1891 EXPECT_EQ(-1, voe_.GetChannelFromLocalSsrc(ssrc)); |
1891 } | 1892 } |
1893 EXPECT_EQ(0u, call_.GetAudioSendStreams().size()); | |
1892 } | 1894 } |
1893 | 1895 |
1894 // Test SetSendCodecs correctly configure the codecs in all send streams. | 1896 // Test SetSendCodecs correctly configure the codecs in all send streams. |
1895 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsWithMultipleSendStreams) { | 1897 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsWithMultipleSendStreams) { |
1896 SetupForMultiSendStream(); | 1898 SetupForMultiSendStream(); |
1897 | 1899 |
1898 static const uint32_t kSsrcs4[] = {1, 2, 3, 4}; | 1900 static const uint32_t kSsrcs4[] = {1, 2, 3, 4}; |
1899 // Create send streams. | 1901 // Create send streams. |
1900 for (unsigned int i = 0; i < ARRAY_SIZE(kSsrcs4); ++i) { | 1902 for (unsigned int i = 0; i < ARRAY_SIZE(kSsrcs4); ++i) { |
1901 EXPECT_TRUE(channel_->AddSendStream( | 1903 EXPECT_TRUE(channel_->AddSendStream( |
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3251 cricket::WebRtcVoiceEngine engine; | 3253 cricket::WebRtcVoiceEngine engine; |
3252 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); | 3254 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); |
3253 rtc::scoped_ptr<webrtc::Call> call( | 3255 rtc::scoped_ptr<webrtc::Call> call( |
3254 webrtc::Call::Create(webrtc::Call::Config())); | 3256 webrtc::Call::Create(webrtc::Call::Config())); |
3255 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), | 3257 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::AudioOptions(), |
3256 call.get()); | 3258 call.get()); |
3257 cricket::AudioRecvParameters parameters; | 3259 cricket::AudioRecvParameters parameters; |
3258 parameters.codecs = engine.codecs(); | 3260 parameters.codecs = engine.codecs(); |
3259 EXPECT_TRUE(channel.SetRecvParameters(parameters)); | 3261 EXPECT_TRUE(channel.SetRecvParameters(parameters)); |
3260 } | 3262 } |
OLD | NEW |