Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2_unittest.cc

Issue 2660403004: Fix and improve FlexFEC configuration for RTP/RTCP. (Closed)
Patch Set: EXPECT -> ASSERT. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 <algorithm> 11 #include <algorithm>
12 #include <map> 12 #include <map>
13 #include <memory> 13 #include <memory>
14 #include <vector> 14 #include <vector>
15 15
16 #include "webrtc/base/arraysize.h" 16 #include "webrtc/base/arraysize.h"
17 #include "webrtc/base/gunit.h" 17 #include "webrtc/base/gunit.h"
18 #include "webrtc/base/stringutils.h" 18 #include "webrtc/base/stringutils.h"
19 #include "webrtc/call/flexfec_receive_stream.h"
19 #include "webrtc/common_video/h264/profile_level_id.h" 20 #include "webrtc/common_video/h264/profile_level_id.h"
20 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" 21 #include "webrtc/logging/rtc_event_log/rtc_event_log.h"
21 #include "webrtc/media/base/mediaconstants.h" 22 #include "webrtc/media/base/mediaconstants.h"
22 #include "webrtc/media/base/testutils.h" 23 #include "webrtc/media/base/testutils.h"
23 #include "webrtc/media/base/videoengine_unittest.h" 24 #include "webrtc/media/base/videoengine_unittest.h"
24 #include "webrtc/media/engine/constants.h" 25 #include "webrtc/media/engine/constants.h"
25 #include "webrtc/media/engine/fakewebrtccall.h" 26 #include "webrtc/media/engine/fakewebrtccall.h"
26 #include "webrtc/media/engine/fakewebrtcvideoengine.h" 27 #include "webrtc/media/engine/fakewebrtcvideoengine.h"
27 #include "webrtc/media/engine/simulcast.h" 28 #include "webrtc/media/engine/simulcast.h"
28 #include "webrtc/media/engine/webrtcvideoengine2.h" 29 #include "webrtc/media/engine/webrtcvideoengine2.h"
(...skipping 2388 matching lines...) Expand 10 before | Expand all | Expand 10 after
2417 2418
2418 FakeVideoSendStream* stream = AddSendStream(); 2419 FakeVideoSendStream* stream = AddSendStream();
2419 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy(); 2420 webrtc::VideoSendStream::Config config = stream->GetConfig().Copy();
2420 2421
2421 EXPECT_EQ(-1, config.rtp.flexfec.payload_type); 2422 EXPECT_EQ(-1, config.rtp.flexfec.payload_type);
2422 } 2423 }
2423 2424
2424 TEST_F(WebRtcVideoChannel2FlexfecTest, SetRecvCodecsWithFec) { 2425 TEST_F(WebRtcVideoChannel2FlexfecTest, SetRecvCodecsWithFec) {
2425 AddRecvStream( 2426 AddRecvStream(
2426 CreatePrimaryWithFecFrStreamParams("cname", kSsrcs1[0], kFlexfecSsrc)); 2427 CreatePrimaryWithFecFrStreamParams("cname", kSsrcs1[0], kFlexfecSsrc));
2427 const std::vector<FakeFlexfecReceiveStream*>& streams =
2428 fake_call_->GetFlexfecReceiveStreams();
2429 2428
2430 cricket::VideoRecvParameters recv_parameters; 2429 cricket::VideoRecvParameters recv_parameters;
2431 recv_parameters.codecs.push_back(GetEngineCodec("VP8")); 2430 recv_parameters.codecs.push_back(GetEngineCodec("VP8"));
2432 recv_parameters.codecs.push_back(GetEngineCodec("flexfec-03")); 2431 recv_parameters.codecs.push_back(GetEngineCodec("flexfec-03"));
2433 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters)); 2432 ASSERT_TRUE(channel_->SetRecvParameters(recv_parameters));
2434 ASSERT_EQ(1U, streams.size()); 2433
2435 const FakeFlexfecReceiveStream* stream_with_recv_params = streams.front(); 2434 const std::vector<FakeFlexfecReceiveStream*>& flexfec_streams =
2435 fake_call_->GetFlexfecReceiveStreams();
2436 ASSERT_EQ(1U, flexfec_streams.size());
2437 const FakeFlexfecReceiveStream* flexfec_stream = flexfec_streams.front();
2438 const webrtc::FlexfecReceiveStream::Config& flexfec_stream_config =
2439 flexfec_stream->GetConfig();
2436 EXPECT_EQ(GetEngineCodec("flexfec-03").id, 2440 EXPECT_EQ(GetEngineCodec("flexfec-03").id,
2437 stream_with_recv_params->GetConfig().payload_type); 2441 flexfec_stream_config.payload_type);
2438 EXPECT_EQ(kFlexfecSsrc, stream_with_recv_params->GetConfig().remote_ssrc); 2442 EXPECT_EQ(kFlexfecSsrc, flexfec_stream_config.remote_ssrc);
2439 EXPECT_EQ(1U, 2443 ASSERT_EQ(1U, flexfec_stream_config.protected_media_ssrcs.size());
2440 stream_with_recv_params->GetConfig().protected_media_ssrcs.size()); 2444 EXPECT_EQ(kSsrcs1[0], flexfec_stream_config.protected_media_ssrcs[0]);
2441 EXPECT_EQ(kSsrcs1[0], 2445 const std::vector<FakeVideoReceiveStream*>& video_streams =
2442 stream_with_recv_params->GetConfig().protected_media_ssrcs[0]); 2446 fake_call_->GetVideoReceiveStreams();
2447 const FakeVideoReceiveStream* video_stream = video_streams.front();
2448 const webrtc::VideoReceiveStream::Config& video_stream_config =
2449 video_stream->GetConfig();
2450 EXPECT_EQ(video_stream_config.rtp.local_ssrc,
2451 flexfec_stream_config.local_ssrc);
2452 EXPECT_EQ(video_stream_config.rtp.rtcp_mode, flexfec_stream_config.rtcp_mode);
2453 EXPECT_EQ(video_stream_config.rtcp_send_transport,
2454 flexfec_stream_config.rtcp_send_transport);
2455 // TODO(brandtr): Update this EXPECT when we set |transport_cc| in a
2456 // spec-compliant way.
2457 EXPECT_EQ(video_stream_config.rtp.transport_cc,
2458 flexfec_stream_config.transport_cc);
2459 EXPECT_EQ(video_stream_config.rtp.rtcp_mode, flexfec_stream_config.rtcp_mode);
2460 EXPECT_EQ(video_stream_config.rtp.extensions,
2461 flexfec_stream_config.rtp_header_extensions);
2443 } 2462 }
2444 2463
2445 TEST_F(WebRtcVideoChannel2Test, 2464 TEST_F(WebRtcVideoChannel2Test,
2446 SetSendCodecRejectsRtxWithoutAssociatedPayloadType) { 2465 SetSendCodecRejectsRtxWithoutAssociatedPayloadType) {
2447 const int kUnusedPayloadType = 127; 2466 const int kUnusedPayloadType = 127;
2448 EXPECT_FALSE(FindCodecById(engine_.codecs(), kUnusedPayloadType)); 2467 EXPECT_FALSE(FindCodecById(engine_.codecs(), kUnusedPayloadType));
2449 2468
2450 cricket::VideoSendParameters parameters; 2469 cricket::VideoSendParameters parameters;
2451 cricket::VideoCodec rtx_codec(kUnusedPayloadType, "rtx"); 2470 cricket::VideoCodec rtx_codec(kUnusedPayloadType, "rtx");
2452 parameters.codecs.push_back(rtx_codec); 2471 parameters.codecs.push_back(rtx_codec);
(...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after
4220 } 4239 }
4221 4240
4222 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsForSimulcastScreenshare) { 4241 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsForSimulcastScreenshare) {
4223 webrtc::test::ScopedFieldTrials override_field_trials_( 4242 webrtc::test::ScopedFieldTrials override_field_trials_(
4224 "WebRTC-SimulcastScreenshare/Enabled/"); 4243 "WebRTC-SimulcastScreenshare/Enabled/");
4225 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 2, true, 4244 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 2, true,
4226 true); 4245 true);
4227 } 4246 }
4228 4247
4229 } // namespace cricket 4248 } // namespace cricket
OLDNEW
« webrtc/media/engine/webrtcvideoengine2.cc ('K') | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698