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

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

Issue 2278883002: Move MutableDataY{,U,V} methods to I420Buffer only. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 3 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
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 // Start at last timestamp to verify that wraparounds are estimated correctly. 2265 // Start at last timestamp to verify that wraparounds are estimated correctly.
2270 static const uint32_t kInitialTimestamp = 0xFFFFFFFFu; 2266 static const uint32_t kInitialTimestamp = 0xFFFFFFFFu;
2271 static const int64_t kInitialNtpTimeMs = 1247891230; 2267 static const int64_t kInitialNtpTimeMs = 1247891230;
2272 static const int kFrameOffsetMs = 20; 2268 static const int kFrameOffsetMs = 20;
2273 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_)); 2269 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_));
2274 2270
2275 FakeVideoReceiveStream* stream = AddRecvStream(); 2271 FakeVideoReceiveStream* stream = AddRecvStream();
2276 cricket::FakeVideoRenderer renderer; 2272 cricket::FakeVideoRenderer renderer;
2277 EXPECT_TRUE(channel_->SetSink(last_ssrc_, &renderer)); 2273 EXPECT_TRUE(channel_->SetSink(last_ssrc_, &renderer));
2278 2274
2279 webrtc::VideoFrame video_frame; 2275 webrtc::VideoFrame video_frame(CreateBlackFrameBuffer(4, 4),
2280 CreateBlackFrame(&video_frame, 4, 4); 2276 kInitialTimestamp, 0,
2281 video_frame.set_timestamp(kInitialTimestamp); 2277 webrtc::kVideoRotation_0);
2282 // Initial NTP time is not available on the first frame, but should still be 2278 // Initial NTP time is not available on the first frame, but should still be
2283 // able to be estimated. 2279 // able to be estimated.
2284 stream->InjectFrame(video_frame); 2280 stream->InjectFrame(video_frame);
2285 2281
2286 EXPECT_EQ(1, renderer.num_rendered_frames()); 2282 EXPECT_EQ(1, renderer.num_rendered_frames());
2287 2283
2288 // This timestamp is kInitialTimestamp (-1) + kFrameOffsetMs * 90, which 2284 // This timestamp is kInitialTimestamp (-1) + kFrameOffsetMs * 90, which
2289 // triggers a constant-overflow warning, hence we're calculating it explicitly 2285 // triggers a constant-overflow warning, hence we're calculating it explicitly
2290 // here. 2286 // here.
2291 video_frame.set_timestamp(kFrameOffsetMs * 90 - 1); 2287 video_frame.set_timestamp(kFrameOffsetMs * 90 - 1);
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
3859 } 3855 }
3860 3856
3861 // Test that we normalize send codec format size in simulcast. 3857 // Test that we normalize send codec format size in simulcast.
3862 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 3858 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
3863 cricket::VideoCodec codec(kVp8Codec270p); 3859 cricket::VideoCodec codec(kVp8Codec270p);
3864 codec.width += 1; 3860 codec.width += 1;
3865 codec.height += 1; 3861 codec.height += 1;
3866 VerifySimulcastSettings(codec, 2, 2); 3862 VerifySimulcastSettings(codec, 2, 2);
3867 } 3863 }
3868 } // namespace cricket 3864 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698