OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2008 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 106 } |
107 void SetupForMultiSendStream() { | 107 void SetupForMultiSendStream() { |
108 EXPECT_TRUE(SetupEngineWithSendStream()); | 108 EXPECT_TRUE(SetupEngineWithSendStream()); |
109 // Remove stream added in Setup. | 109 // Remove stream added in Setup. |
110 EXPECT_TRUE(call_.GetAudioSendStream(kSsrc1)); | 110 EXPECT_TRUE(call_.GetAudioSendStream(kSsrc1)); |
111 EXPECT_TRUE(channel_->RemoveSendStream(kSsrc1)); | 111 EXPECT_TRUE(channel_->RemoveSendStream(kSsrc1)); |
112 // Verify the channel does not exist. | 112 // Verify the channel does not exist. |
113 EXPECT_FALSE(call_.GetAudioSendStream(kSsrc1)); | 113 EXPECT_FALSE(call_.GetAudioSendStream(kSsrc1)); |
114 } | 114 } |
115 void DeliverPacket(const void* data, int len) { | 115 void DeliverPacket(const void* data, int len) { |
116 rtc::Buffer packet(reinterpret_cast<const uint8_t*>(data), len); | 116 rtc::CopyOnWriteBuffer packet(reinterpret_cast<const uint8_t*>(data), len); |
117 channel_->OnPacketReceived(&packet, rtc::PacketTime()); | 117 channel_->OnPacketReceived(&packet, rtc::PacketTime()); |
118 } | 118 } |
119 void TearDown() override { | 119 void TearDown() override { |
120 delete channel_; | 120 delete channel_; |
121 engine_.Terminate(); | 121 engine_.Terminate(); |
122 } | 122 } |
123 | 123 |
124 const cricket::FakeAudioSendStream& GetSendStream(uint32_t ssrc) { | 124 const cricket::FakeAudioSendStream& GetSendStream(uint32_t ssrc) { |
125 const auto* send_stream = call_.GetAudioSendStream(ssrc); | 125 const auto* send_stream = call_.GetAudioSendStream(ssrc); |
126 EXPECT_TRUE(send_stream); | 126 EXPECT_TRUE(send_stream); |
(...skipping 2926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3053 for (uint32_t ssrc : ssrcs) { | 3053 for (uint32_t ssrc : ssrcs) { |
3054 const auto* s = call_.GetAudioReceiveStream(ssrc); | 3054 const auto* s = call_.GetAudioReceiveStream(ssrc); |
3055 EXPECT_NE(nullptr, s); | 3055 EXPECT_NE(nullptr, s); |
3056 EXPECT_EQ(0, s->GetConfig().rtp.extensions.size()); | 3056 EXPECT_EQ(0, s->GetConfig().rtp.extensions.size()); |
3057 } | 3057 } |
3058 } | 3058 } |
3059 | 3059 |
3060 TEST_F(WebRtcVoiceEngineTestFake, DeliverAudioPacket_Call) { | 3060 TEST_F(WebRtcVoiceEngineTestFake, DeliverAudioPacket_Call) { |
3061 // Test that packets are forwarded to the Call when configured accordingly. | 3061 // Test that packets are forwarded to the Call when configured accordingly. |
3062 const uint32_t kAudioSsrc = 1; | 3062 const uint32_t kAudioSsrc = 1; |
3063 rtc::Buffer kPcmuPacket(kPcmuFrame, sizeof(kPcmuFrame)); | 3063 rtc::CopyOnWriteBuffer kPcmuPacket(kPcmuFrame, sizeof(kPcmuFrame)); |
3064 static const unsigned char kRtcp[] = { | 3064 static const unsigned char kRtcp[] = { |
3065 0x80, 0xc9, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, | 3065 0x80, 0xc9, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, |
3066 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, | 3066 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, |
3067 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 3067 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
3068 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | 3068 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
3069 }; | 3069 }; |
3070 rtc::Buffer kRtcpPacket(kRtcp, sizeof(kRtcp)); | 3070 rtc::CopyOnWriteBuffer kRtcpPacket(kRtcp, sizeof(kRtcp)); |
3071 | 3071 |
3072 EXPECT_TRUE(SetupEngineWithSendStream()); | 3072 EXPECT_TRUE(SetupEngineWithSendStream()); |
3073 cricket::WebRtcVoiceMediaChannel* media_channel = | 3073 cricket::WebRtcVoiceMediaChannel* media_channel = |
3074 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); | 3074 static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_); |
3075 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); | 3075 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); |
3076 EXPECT_TRUE(media_channel->AddRecvStream( | 3076 EXPECT_TRUE(media_channel->AddRecvStream( |
3077 cricket::StreamParams::CreateLegacy(kAudioSsrc))); | 3077 cricket::StreamParams::CreateLegacy(kAudioSsrc))); |
3078 | 3078 |
3079 EXPECT_EQ(1, call_.GetAudioReceiveStreams().size()); | 3079 EXPECT_EQ(1, call_.GetAudioReceiveStreams().size()); |
3080 const cricket::FakeAudioReceiveStream* s = | 3080 const cricket::FakeAudioReceiveStream* s = |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3305 cricket::WebRtcVoiceEngine engine; | 3305 cricket::WebRtcVoiceEngine engine; |
3306 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); | 3306 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); |
3307 std::unique_ptr<webrtc::Call> call( | 3307 std::unique_ptr<webrtc::Call> call( |
3308 webrtc::Call::Create(webrtc::Call::Config())); | 3308 webrtc::Call::Create(webrtc::Call::Config())); |
3309 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), | 3309 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), |
3310 cricket::AudioOptions(), call.get()); | 3310 cricket::AudioOptions(), call.get()); |
3311 cricket::AudioRecvParameters parameters; | 3311 cricket::AudioRecvParameters parameters; |
3312 parameters.codecs = engine.codecs(); | 3312 parameters.codecs = engine.codecs(); |
3313 EXPECT_TRUE(channel.SetRecvParameters(parameters)); | 3313 EXPECT_TRUE(channel.SetRecvParameters(parameters)); |
3314 } | 3314 } |
OLD | NEW |