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 rtc::scoped_refptr<webrtc::VideoFrameBuffer> CreateBlackFrameBuffer( | 69 static void CreateBlackFrame(webrtc::VideoFrame* video_frame, |
70 int width, | 70 int width, |
71 int height) { | 71 int height) { |
72 rtc::scoped_refptr<webrtc::I420Buffer> buffer = | 72 video_frame->CreateEmptyFrame( |
73 webrtc::I420Buffer::Create(width, height); | 73 width, height, width, (width + 1) / 2, (width + 1) / 2); |
74 buffer->SetToBlack(); | 74 memset(video_frame->video_frame_buffer()->MutableDataY(), 16, |
75 return buffer; | 75 video_frame->allocated_size(webrtc::kYPlane)); |
| 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)); |
76 } | 80 } |
77 | 81 |
78 void VerifySendStreamHasRtxTypes(const webrtc::VideoSendStream::Config& config, | 82 void VerifySendStreamHasRtxTypes(const webrtc::VideoSendStream::Config& config, |
79 const std::map<int, int>& rtx_types) { | 83 const std::map<int, int>& rtx_types) { |
80 std::map<int, int>::const_iterator it; | 84 std::map<int, int>::const_iterator it; |
81 it = rtx_types.find(config.encoder_settings.payload_type); | 85 it = rtx_types.find(config.encoder_settings.payload_type); |
82 EXPECT_TRUE(it != rtx_types.end() && | 86 EXPECT_TRUE(it != rtx_types.end() && |
83 it->second == config.rtp.rtx.payload_type); | 87 it->second == config.rtp.rtx.payload_type); |
84 | 88 |
85 if (config.rtp.fec.red_rtx_payload_type != -1) { | 89 if (config.rtp.fec.red_rtx_payload_type != -1) { |
(...skipping 2107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2193 // Start at last timestamp to verify that wraparounds are estimated correctly. | 2197 // Start at last timestamp to verify that wraparounds are estimated correctly. |
2194 static const uint32_t kInitialTimestamp = 0xFFFFFFFFu; | 2198 static const uint32_t kInitialTimestamp = 0xFFFFFFFFu; |
2195 static const int64_t kInitialNtpTimeMs = 1247891230; | 2199 static const int64_t kInitialNtpTimeMs = 1247891230; |
2196 static const int kFrameOffsetMs = 20; | 2200 static const int kFrameOffsetMs = 20; |
2197 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_)); | 2201 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_)); |
2198 | 2202 |
2199 FakeVideoReceiveStream* stream = AddRecvStream(); | 2203 FakeVideoReceiveStream* stream = AddRecvStream(); |
2200 cricket::FakeVideoRenderer renderer; | 2204 cricket::FakeVideoRenderer renderer; |
2201 EXPECT_TRUE(channel_->SetSink(last_ssrc_, &renderer)); | 2205 EXPECT_TRUE(channel_->SetSink(last_ssrc_, &renderer)); |
2202 | 2206 |
2203 webrtc::VideoFrame video_frame(CreateBlackFrameBuffer(4, 4), | 2207 webrtc::VideoFrame video_frame; |
2204 kInitialTimestamp, 0, | 2208 CreateBlackFrame(&video_frame, 4, 4); |
2205 webrtc::kVideoRotation_0); | 2209 video_frame.set_timestamp(kInitialTimestamp); |
2206 // Initial NTP time is not available on the first frame, but should still be | 2210 // Initial NTP time is not available on the first frame, but should still be |
2207 // able to be estimated. | 2211 // able to be estimated. |
2208 stream->InjectFrame(video_frame); | 2212 stream->InjectFrame(video_frame); |
2209 | 2213 |
2210 EXPECT_EQ(1, renderer.num_rendered_frames()); | 2214 EXPECT_EQ(1, renderer.num_rendered_frames()); |
2211 | 2215 |
2212 // This timestamp is kInitialTimestamp (-1) + kFrameOffsetMs * 90, which | 2216 // This timestamp is kInitialTimestamp (-1) + kFrameOffsetMs * 90, which |
2213 // triggers a constant-overflow warning, hence we're calculating it explicitly | 2217 // triggers a constant-overflow warning, hence we're calculating it explicitly |
2214 // here. | 2218 // here. |
2215 video_frame.set_timestamp(kFrameOffsetMs * 90 - 1); | 2219 video_frame.set_timestamp(kFrameOffsetMs * 90 - 1); |
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3823 } | 3827 } |
3824 | 3828 |
3825 // Test that we normalize send codec format size in simulcast. | 3829 // Test that we normalize send codec format size in simulcast. |
3826 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { | 3830 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { |
3827 cricket::VideoCodec codec(kVp8Codec270p); | 3831 cricket::VideoCodec codec(kVp8Codec270p); |
3828 codec.width += 1; | 3832 codec.width += 1; |
3829 codec.height += 1; | 3833 codec.height += 1; |
3830 VerifySimulcastSettings(codec, 2, 2); | 3834 VerifySimulcastSettings(codec, 2, 2); |
3831 } | 3835 } |
3832 } // namespace cricket | 3836 } // namespace cricket |
OLD | NEW |