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

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

Issue 1785713005: Use CopyOnWriteBuffer instead of Buffer to avoid unnecessary copies. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Feedback from tommi. Created 4 years, 9 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
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | webrtc/media/engine/webrtcvoiceengine.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2858 matching lines...) Expand 10 before | Expand all | Expand 10 after
2869 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 2869 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
2870 2870
2871 const std::vector<uint32_t> ssrcs = MAKE_VECTOR(kSsrcs1); 2871 const std::vector<uint32_t> ssrcs = MAKE_VECTOR(kSsrcs1);
2872 const std::vector<uint32_t> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1); 2872 const std::vector<uint32_t> rtx_ssrcs = MAKE_VECTOR(kRtxSsrcs1);
2873 2873
2874 ASSERT_EQ(0u, fake_call_->GetVideoReceiveStreams().size()); 2874 ASSERT_EQ(0u, fake_call_->GetVideoReceiveStreams().size());
2875 const size_t kDataLength = 12; 2875 const size_t kDataLength = 12;
2876 uint8_t data[kDataLength]; 2876 uint8_t data[kDataLength];
2877 memset(data, 0, sizeof(data)); 2877 memset(data, 0, sizeof(data));
2878 rtc::SetBE32(&data[8], ssrcs[0]); 2878 rtc::SetBE32(&data[8], ssrcs[0]);
2879 rtc::Buffer packet(data, kDataLength); 2879 rtc::CopyOnWriteBuffer packet(data, kDataLength);
2880 rtc::PacketTime packet_time; 2880 rtc::PacketTime packet_time;
2881 channel_->OnPacketReceived(&packet, packet_time); 2881 channel_->OnPacketReceived(&packet, packet_time);
2882 2882
2883 ASSERT_EQ(1u, fake_call_->GetVideoReceiveStreams().size()) 2883 ASSERT_EQ(1u, fake_call_->GetVideoReceiveStreams().size())
2884 << "No default receive stream created."; 2884 << "No default receive stream created.";
2885 FakeVideoReceiveStream* recv_stream = fake_call_->GetVideoReceiveStreams()[0]; 2885 FakeVideoReceiveStream* recv_stream = fake_call_->GetVideoReceiveStreams()[0];
2886 EXPECT_EQ(0u, recv_stream->GetConfig().rtp.rtx.size()) 2886 EXPECT_EQ(0u, recv_stream->GetConfig().rtp.rtx.size())
2887 << "Default receive stream should not have configured RTX"; 2887 << "Default receive stream should not have configured RTX";
2888 2888
2889 EXPECT_TRUE(channel_->AddRecvStream( 2889 EXPECT_TRUE(channel_->AddRecvStream(
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3022 recv_parameters_.codecs.push_back(red_rtx_codec); 3022 recv_parameters_.codecs.push_back(red_rtx_codec);
3023 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_)); 3023 EXPECT_TRUE(channel_->SetRecvParameters(recv_parameters_));
3024 3024
3025 ASSERT_EQ(0u, fake_call_->GetVideoReceiveStreams().size()); 3025 ASSERT_EQ(0u, fake_call_->GetVideoReceiveStreams().size());
3026 const size_t kDataLength = 12; 3026 const size_t kDataLength = 12;
3027 uint8_t data[kDataLength]; 3027 uint8_t data[kDataLength];
3028 memset(data, 0, sizeof(data)); 3028 memset(data, 0, sizeof(data));
3029 3029
3030 rtc::Set8(data, 1, payload_type); 3030 rtc::Set8(data, 1, payload_type);
3031 rtc::SetBE32(&data[8], kIncomingUnsignalledSsrc); 3031 rtc::SetBE32(&data[8], kIncomingUnsignalledSsrc);
3032 rtc::Buffer packet(data, kDataLength); 3032 rtc::CopyOnWriteBuffer packet(data, kDataLength);
3033 rtc::PacketTime packet_time; 3033 rtc::PacketTime packet_time;
3034 channel_->OnPacketReceived(&packet, packet_time); 3034 channel_->OnPacketReceived(&packet, packet_time);
3035 3035
3036 if (expect_created_receive_stream) { 3036 if (expect_created_receive_stream) {
3037 EXPECT_EQ(1u, fake_call_->GetVideoReceiveStreams().size()) 3037 EXPECT_EQ(1u, fake_call_->GetVideoReceiveStreams().size())
3038 << "Should have created a receive stream for payload type: " 3038 << "Should have created a receive stream for payload type: "
3039 << payload_type; 3039 << payload_type;
3040 } else { 3040 } else {
3041 EXPECT_EQ(0u, fake_call_->GetVideoReceiveStreams().size()) 3041 EXPECT_EQ(0u, fake_call_->GetVideoReceiveStreams().size())
3042 << "Shouldn't have created a receive stream for payload type: " 3042 << "Shouldn't have created a receive stream for payload type: "
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
3252 3252
3253 // Test that we normalize send codec format size in simulcast. 3253 // Test that we normalize send codec format size in simulcast.
3254 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 3254 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
3255 cricket::VideoCodec codec(kVp8Codec270p); 3255 cricket::VideoCodec codec(kVp8Codec270p);
3256 codec.width += 1; 3256 codec.width += 1;
3257 codec.height += 1; 3257 codec.height += 1;
3258 VerifySimulcastSettings(codec, 2, 2); 3258 VerifySimulcastSettings(codec, 2, 2);
3259 } 3259 }
3260 } // namespace cricket 3260 } // namespace cricket
3261 3261
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | webrtc/media/engine/webrtcvoiceengine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698