OLD | NEW |
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 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( | 59 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( |
60 cricket::kRtcpFbParamNack, cricket::kRtcpFbNackParamPli))); | 60 cricket::kRtcpFbParamNack, cricket::kRtcpFbNackParamPli))); |
61 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( | 61 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( |
62 cricket::kRtcpFbParamRemb, cricket::kParamValueEmpty))); | 62 cricket::kRtcpFbParamRemb, cricket::kParamValueEmpty))); |
63 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( | 63 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( |
64 cricket::kRtcpFbParamTransportCc, cricket::kParamValueEmpty))); | 64 cricket::kRtcpFbParamTransportCc, cricket::kParamValueEmpty))); |
65 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( | 65 EXPECT_TRUE(codec.HasFeedbackParam(cricket::FeedbackParam( |
66 cricket::kRtcpFbParamCcm, cricket::kRtcpFbCcmParamFir))); | 66 cricket::kRtcpFbParamCcm, cricket::kRtcpFbCcmParamFir))); |
67 } | 67 } |
68 | 68 |
69 static void CreateBlackFrame(webrtc::VideoFrame* video_frame, | 69 static rtc::scoped_refptr<webrtc::VideoFrameBuffer> CreateBlackFrameBuffer( |
70 int width, | 70 int width, |
71 int height) { | 71 int height) { |
72 video_frame->CreateEmptyFrame( | 72 rtc::scoped_refptr<webrtc::I420Buffer> buffer = |
73 width, height, width, (width + 1) / 2, (width + 1) / 2); | 73 webrtc::I420Buffer::Create(width, height); |
74 memset(video_frame->video_frame_buffer()->MutableDataY(), 16, | 74 buffer->SetToBlack(); |
75 video_frame->allocated_size(webrtc::kYPlane)); | 75 return buffer; |
76 memset(video_frame->video_frame_buffer()->MutableDataU(), 128, | |
77 video_frame->allocated_size(webrtc::kUPlane)); | |
78 memset(video_frame->video_frame_buffer()->MutableDataV(), 128, | |
79 video_frame->allocated_size(webrtc::kVPlane)); | |
80 } | 76 } |
81 | 77 |
82 void VerifySendStreamHasRtxTypes(const webrtc::VideoSendStream::Config& config, | 78 void VerifySendStreamHasRtxTypes(const webrtc::VideoSendStream::Config& config, |
83 const std::map<int, int>& rtx_types) { | 79 const std::map<int, int>& rtx_types) { |
84 std::map<int, int>::const_iterator it; | 80 std::map<int, int>::const_iterator it; |
85 it = rtx_types.find(config.encoder_settings.payload_type); | 81 it = rtx_types.find(config.encoder_settings.payload_type); |
86 EXPECT_TRUE(it != rtx_types.end() && | 82 EXPECT_TRUE(it != rtx_types.end() && |
87 it->second == config.rtp.rtx.payload_type); | 83 it->second == config.rtp.rtx.payload_type); |
88 | 84 |
89 if (config.rtp.fec.red_rtx_payload_type != -1) { | 85 if (config.rtp.fec.red_rtx_payload_type != -1) { |
(...skipping 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2266 // Start at last timestamp to verify that wraparounds are estimated correctly. | 2262 // Start at last timestamp to verify that wraparounds are estimated correctly. |
2267 static const uint32_t kInitialTimestamp = 0xFFFFFFFFu; | 2263 static const uint32_t kInitialTimestamp = 0xFFFFFFFFu; |
2268 static const int64_t kInitialNtpTimeMs = 1247891230; | 2264 static const int64_t kInitialNtpTimeMs = 1247891230; |
2269 static const int kFrameOffsetMs = 20; | 2265 static const int kFrameOffsetMs = 20; |
2270 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_)); | 2266 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_)); |
2271 | 2267 |
2272 FakeVideoReceiveStream* stream = AddRecvStream(); | 2268 FakeVideoReceiveStream* stream = AddRecvStream(); |
2273 cricket::FakeVideoRenderer renderer; | 2269 cricket::FakeVideoRenderer renderer; |
2274 EXPECT_TRUE(channel_->SetSink(last_ssrc_, &renderer)); | 2270 EXPECT_TRUE(channel_->SetSink(last_ssrc_, &renderer)); |
2275 | 2271 |
2276 webrtc::VideoFrame video_frame; | 2272 webrtc::VideoFrame video_frame(CreateBlackFrameBuffer(4, 4), |
2277 CreateBlackFrame(&video_frame, 4, 4); | 2273 kInitialTimestamp, 0, |
2278 video_frame.set_timestamp(kInitialTimestamp); | 2274 webrtc::kVideoRotation_0); |
2279 // Initial NTP time is not available on the first frame, but should still be | 2275 // Initial NTP time is not available on the first frame, but should still be |
2280 // able to be estimated. | 2276 // able to be estimated. |
2281 stream->InjectFrame(video_frame); | 2277 stream->InjectFrame(video_frame); |
2282 | 2278 |
2283 EXPECT_EQ(1, renderer.num_rendered_frames()); | 2279 EXPECT_EQ(1, renderer.num_rendered_frames()); |
2284 | 2280 |
2285 // This timestamp is kInitialTimestamp (-1) + kFrameOffsetMs * 90, which | 2281 // This timestamp is kInitialTimestamp (-1) + kFrameOffsetMs * 90, which |
2286 // triggers a constant-overflow warning, hence we're calculating it explicitly | 2282 // triggers a constant-overflow warning, hence we're calculating it explicitly |
2287 // here. | 2283 // here. |
2288 video_frame.set_timestamp(kFrameOffsetMs * 90 - 1); | 2284 video_frame.set_timestamp(kFrameOffsetMs * 90 - 1); |
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3848 } | 3844 } |
3849 | 3845 |
3850 // Test that we normalize send codec format size in simulcast. | 3846 // Test that we normalize send codec format size in simulcast. |
3851 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { | 3847 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { |
3852 cricket::VideoCodec codec(kVp8Codec270p); | 3848 cricket::VideoCodec codec(kVp8Codec270p); |
3853 codec.width += 1; | 3849 codec.width += 1; |
3854 codec.height += 1; | 3850 codec.height += 1; |
3855 VerifySimulcastSettings(codec, 2, 2); | 3851 VerifySimulcastSettings(codec, 2, 2); |
3856 } | 3852 } |
3857 } // namespace cricket | 3853 } // namespace cricket |
OLD | NEW |