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

Side by Side Diff: webrtc/video/end_to_end_tests.cc

Issue 1751903002: Replace scoped_ptr with unique_ptr in webrtc/video/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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/video/call_stats_unittest.cc ('k') | webrtc/video/overuse_frame_detector.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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 #include <algorithm> 10 #include <algorithm>
11 #include <list> 11 #include <list>
12 #include <map> 12 #include <map>
13 #include <memory>
13 #include <sstream> 14 #include <sstream>
14 #include <string> 15 #include <string>
15 16
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 #include "webrtc/base/checks.h" 19 #include "webrtc/base/checks.h"
19 #include "webrtc/base/event.h" 20 #include "webrtc/base/event.h"
20 #include "webrtc/base/scoped_ptr.h"
21 #include "webrtc/base/timeutils.h" 21 #include "webrtc/base/timeutils.h"
22 #include "webrtc/call.h" 22 #include "webrtc/call.h"
23 #include "webrtc/call/transport_adapter.h" 23 #include "webrtc/call/transport_adapter.h"
24 #include "webrtc/frame_callback.h" 24 #include "webrtc/frame_callback.h"
25 #include "webrtc/modules/include/module_common_types.h" 25 #include "webrtc/modules/include/module_common_types.h"
26 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" 26 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
27 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 27 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
28 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
29 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" 29 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h"
30 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" 30 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 TestFrameCallback pre_render_callback; 167 TestFrameCallback pre_render_callback;
168 video_receive_configs_[0].pre_render_callback = &pre_render_callback; 168 video_receive_configs_[0].pre_render_callback = &pre_render_callback;
169 video_receive_configs_[0].renderer = &renderer; 169 video_receive_configs_[0].renderer = &renderer;
170 170
171 CreateVideoStreams(); 171 CreateVideoStreams();
172 Start(); 172 Start();
173 173
174 // Create frames that are smaller than the send width/height, this is done to 174 // Create frames that are smaller than the send width/height, this is done to
175 // check that the callbacks are done after processing video. 175 // check that the callbacks are done after processing video.
176 rtc::scoped_ptr<test::FrameGenerator> frame_generator( 176 std::unique_ptr<test::FrameGenerator> frame_generator(
177 test::FrameGenerator::CreateChromaGenerator(kWidth, kHeight)); 177 test::FrameGenerator::CreateChromaGenerator(kWidth, kHeight));
178 video_send_stream_->Input()->IncomingCapturedFrame( 178 video_send_stream_->Input()->IncomingCapturedFrame(
179 *frame_generator->NextFrame()); 179 *frame_generator->NextFrame());
180 EXPECT_TRUE(pre_render_callback.Wait()) 180 EXPECT_TRUE(pre_render_callback.Wait())
181 << "Timed out while waiting for pre-render callback."; 181 << "Timed out while waiting for pre-render callback.";
182 EXPECT_TRUE(renderer.Wait()) 182 EXPECT_TRUE(renderer.Wait())
183 << "Timed out while waiting for the frame to render."; 183 << "Timed out while waiting for the frame to render.";
184 184
185 Stop(); 185 Stop();
186 186
(...skipping 26 matching lines...) Expand all
213 sender_transport.SetReceiver(receiver_call_->Receiver()); 213 sender_transport.SetReceiver(receiver_call_->Receiver());
214 receiver_transport.SetReceiver(sender_call_->Receiver()); 214 receiver_transport.SetReceiver(sender_call_->Receiver());
215 215
216 CreateSendConfig(1, 0, &sender_transport); 216 CreateSendConfig(1, 0, &sender_transport);
217 CreateMatchingReceiveConfigs(&receiver_transport); 217 CreateMatchingReceiveConfigs(&receiver_transport);
218 video_receive_configs_[0].renderer = &renderer; 218 video_receive_configs_[0].renderer = &renderer;
219 219
220 CreateVideoStreams(); 220 CreateVideoStreams();
221 Start(); 221 Start();
222 222
223 rtc::scoped_ptr<test::FrameGenerator> frame_generator( 223 std::unique_ptr<test::FrameGenerator> frame_generator(
224 test::FrameGenerator::CreateChromaGenerator( 224 test::FrameGenerator::CreateChromaGenerator(
225 video_encoder_config_.streams[0].width, 225 video_encoder_config_.streams[0].width,
226 video_encoder_config_.streams[0].height)); 226 video_encoder_config_.streams[0].height));
227 video_send_stream_->Input()->IncomingCapturedFrame( 227 video_send_stream_->Input()->IncomingCapturedFrame(
228 *frame_generator->NextFrame()); 228 *frame_generator->NextFrame());
229 229
230 EXPECT_TRUE(renderer.Wait()) 230 EXPECT_TRUE(renderer.Wait())
231 << "Timed out while waiting for the frame to render."; 231 << "Timed out while waiting for the frame to render.";
232 232
233 Stop(); 233 Stop();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 void RenderFrame(const VideoFrame& video_frame, 275 void RenderFrame(const VideoFrame& video_frame,
276 int time_to_render_ms) override { 276 int time_to_render_ms) override {
277 const int kRequiredFrames = 500; 277 const int kRequiredFrames = 500;
278 if (++frame_counter_ == kRequiredFrames) 278 if (++frame_counter_ == kRequiredFrames)
279 observation_complete_.Set(); 279 observation_complete_.Set();
280 } 280 }
281 281
282 bool IsTextureSupported() const override { return false; } 282 bool IsTextureSupported() const override { return false; }
283 283
284 private: 284 private:
285 rtc::scoped_ptr<webrtc::VideoEncoder> encoder_; 285 std::unique_ptr<webrtc::VideoEncoder> encoder_;
286 rtc::scoped_ptr<webrtc::VideoDecoder> decoder_; 286 std::unique_ptr<webrtc::VideoDecoder> decoder_;
287 int frame_counter_; 287 int frame_counter_;
288 } test; 288 } test;
289 289
290 RunBaseTest(&test); 290 RunBaseTest(&test);
291 } 291 }
292 292
293 #if defined(WEBRTC_END_TO_END_H264_TESTS) 293 #if defined(WEBRTC_END_TO_END_H264_TESTS)
294 294
295 TEST_F(EndToEndTest, SendsAndReceivesH264) { 295 TEST_F(EndToEndTest, SendsAndReceivesH264) {
296 class H264Observer : public test::EndToEndTest, public VideoRenderer { 296 class H264Observer : public test::EndToEndTest, public VideoRenderer {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 void RenderFrame(const VideoFrame& video_frame, 331 void RenderFrame(const VideoFrame& video_frame,
332 int time_to_render_ms) override { 332 int time_to_render_ms) override {
333 const int kRequiredFrames = 500; 333 const int kRequiredFrames = 500;
334 if (++frame_counter_ == kRequiredFrames) 334 if (++frame_counter_ == kRequiredFrames)
335 observation_complete_.Set(); 335 observation_complete_.Set();
336 } 336 }
337 337
338 bool IsTextureSupported() const override { return false; } 338 bool IsTextureSupported() const override { return false; }
339 339
340 private: 340 private:
341 rtc::scoped_ptr<webrtc::VideoEncoder> encoder_; 341 std::unique_ptr<webrtc::VideoEncoder> encoder_;
342 rtc::scoped_ptr<webrtc::VideoDecoder> decoder_; 342 std::unique_ptr<webrtc::VideoDecoder> decoder_;
343 int frame_counter_; 343 int frame_counter_;
344 } test; 344 } test;
345 345
346 RunBaseTest(&test); 346 RunBaseTest(&test);
347 } 347 }
348 348
349 #endif // defined(WEBRTC_END_TO_END_H264_TESTS) 349 #endif // defined(WEBRTC_END_TO_END_H264_TESTS)
350 350
351 TEST_F(EndToEndTest, ReceiverUsesLocalSsrc) { 351 TEST_F(EndToEndTest, ReceiverUsesLocalSsrc) {
352 class SyncRtcpObserver : public test::EndToEndTest { 352 class SyncRtcpObserver : public test::EndToEndTest {
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 } 809 }
810 if (use_rtx) 810 if (use_rtx)
811 return kSendRtxPayloadType; 811 return kSendRtxPayloadType;
812 return kFakeVideoSendPayloadType; 812 return kFakeVideoSendPayloadType;
813 } 813 }
814 814
815 rtc::CriticalSection crit_; 815 rtc::CriticalSection crit_;
816 const int payload_type_; 816 const int payload_type_;
817 const uint32_t retransmission_ssrc_; 817 const uint32_t retransmission_ssrc_;
818 const int retransmission_payload_type_; 818 const int retransmission_payload_type_;
819 rtc::scoped_ptr<VideoEncoder> encoder_; 819 std::unique_ptr<VideoEncoder> encoder_;
820 const std::string payload_name_; 820 const std::string payload_name_;
821 int marker_bits_observed_; 821 int marker_bits_observed_;
822 uint32_t retransmitted_timestamp_ GUARDED_BY(&crit_); 822 uint32_t retransmitted_timestamp_ GUARDED_BY(&crit_);
823 bool frame_retransmitted_; 823 bool frame_retransmitted_;
824 } test(enable_rtx, enable_red); 824 } test(enable_rtx, enable_red);
825 825
826 RunBaseTest(&test); 826 RunBaseTest(&test);
827 } 827 }
828 828
829 TEST_F(EndToEndTest, DecodesRetransmittedFrame) { 829 TEST_F(EndToEndTest, DecodesRetransmittedFrame) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 TestFrameCallback pre_render_callback(255, 0); // Changes luma from 255 to 0. 901 TestFrameCallback pre_render_callback(255, 0); // Changes luma from 255 to 0.
902 902
903 CreateCalls(Call::Config(), Call::Config()); 903 CreateCalls(Call::Config(), Call::Config());
904 904
905 test::DirectTransport sender_transport(sender_call_.get()); 905 test::DirectTransport sender_transport(sender_call_.get());
906 test::DirectTransport receiver_transport(receiver_call_.get()); 906 test::DirectTransport receiver_transport(receiver_call_.get());
907 sender_transport.SetReceiver(receiver_call_->Receiver()); 907 sender_transport.SetReceiver(receiver_call_->Receiver());
908 receiver_transport.SetReceiver(sender_call_->Receiver()); 908 receiver_transport.SetReceiver(sender_call_->Receiver());
909 909
910 CreateSendConfig(1, 0, &sender_transport); 910 CreateSendConfig(1, 0, &sender_transport);
911 rtc::scoped_ptr<VideoEncoder> encoder( 911 std::unique_ptr<VideoEncoder> encoder(
912 VideoEncoder::Create(VideoEncoder::kVp8)); 912 VideoEncoder::Create(VideoEncoder::kVp8));
913 video_send_config_.encoder_settings.encoder = encoder.get(); 913 video_send_config_.encoder_settings.encoder = encoder.get();
914 video_send_config_.encoder_settings.payload_name = "VP8"; 914 video_send_config_.encoder_settings.payload_name = "VP8";
915 ASSERT_EQ(1u, video_encoder_config_.streams.size()) << "Test setup error."; 915 ASSERT_EQ(1u, video_encoder_config_.streams.size()) << "Test setup error.";
916 video_encoder_config_.streams[0].width = kWidth; 916 video_encoder_config_.streams[0].width = kWidth;
917 video_encoder_config_.streams[0].height = kHeight; 917 video_encoder_config_.streams[0].height = kHeight;
918 video_send_config_.pre_encode_callback = &pre_encode_callback; 918 video_send_config_.pre_encode_callback = &pre_encode_callback;
919 919
920 CreateMatchingReceiveConfigs(&receiver_transport); 920 CreateMatchingReceiveConfigs(&receiver_transport);
921 video_receive_configs_[0].pre_render_callback = &pre_render_callback; 921 video_receive_configs_[0].pre_render_callback = &pre_render_callback;
922 video_receive_configs_[0].renderer = &renderer; 922 video_receive_configs_[0].renderer = &renderer;
923 923
924 CreateVideoStreams(); 924 CreateVideoStreams();
925 Start(); 925 Start();
926 926
927 // Create frames that are smaller than the send width/height, this is done to 927 // Create frames that are smaller than the send width/height, this is done to
928 // check that the callbacks are done after processing video. 928 // check that the callbacks are done after processing video.
929 rtc::scoped_ptr<test::FrameGenerator> frame_generator( 929 std::unique_ptr<test::FrameGenerator> frame_generator(
930 test::FrameGenerator::CreateChromaGenerator(kWidth / 2, kHeight / 2)); 930 test::FrameGenerator::CreateChromaGenerator(kWidth / 2, kHeight / 2));
931 video_send_stream_->Input()->IncomingCapturedFrame( 931 video_send_stream_->Input()->IncomingCapturedFrame(
932 *frame_generator->NextFrame()); 932 *frame_generator->NextFrame());
933 933
934 EXPECT_TRUE(pre_encode_callback.Wait()) 934 EXPECT_TRUE(pre_encode_callback.Wait())
935 << "Timed out while waiting for pre-encode callback."; 935 << "Timed out while waiting for pre-encode callback.";
936 EXPECT_TRUE(pre_render_callback.Wait()) 936 EXPECT_TRUE(pre_render_callback.Wait())
937 << "Timed out while waiting for pre-render callback."; 937 << "Timed out while waiting for pre-render callback.";
938 EXPECT_TRUE(renderer.Wait()) 938 EXPECT_TRUE(renderer.Wait())
939 << "Timed out while waiting for the frame to render."; 939 << "Timed out while waiting for the frame to render.";
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 MultiStreamTest() { 1206 MultiStreamTest() {
1207 // TODO(sprang): Cleanup when msvc supports explicit initializers for array. 1207 // TODO(sprang): Cleanup when msvc supports explicit initializers for array.
1208 codec_settings[0] = {1, 640, 480}; 1208 codec_settings[0] = {1, 640, 480};
1209 codec_settings[1] = {2, 320, 240}; 1209 codec_settings[1] = {2, 320, 240};
1210 codec_settings[2] = {3, 240, 160}; 1210 codec_settings[2] = {3, 240, 160};
1211 } 1211 }
1212 1212
1213 virtual ~MultiStreamTest() {} 1213 virtual ~MultiStreamTest() {}
1214 1214
1215 void RunTest() { 1215 void RunTest() {
1216 rtc::scoped_ptr<Call> sender_call(Call::Create(Call::Config())); 1216 std::unique_ptr<Call> sender_call(Call::Create(Call::Config()));
1217 rtc::scoped_ptr<Call> receiver_call(Call::Create(Call::Config())); 1217 std::unique_ptr<Call> receiver_call(Call::Create(Call::Config()));
1218 rtc::scoped_ptr<test::DirectTransport> sender_transport( 1218 std::unique_ptr<test::DirectTransport> sender_transport(
1219 CreateSendTransport(sender_call.get())); 1219 CreateSendTransport(sender_call.get()));
1220 rtc::scoped_ptr<test::DirectTransport> receiver_transport( 1220 std::unique_ptr<test::DirectTransport> receiver_transport(
1221 CreateReceiveTransport(receiver_call.get())); 1221 CreateReceiveTransport(receiver_call.get()));
1222 sender_transport->SetReceiver(receiver_call->Receiver()); 1222 sender_transport->SetReceiver(receiver_call->Receiver());
1223 receiver_transport->SetReceiver(sender_call->Receiver()); 1223 receiver_transport->SetReceiver(sender_call->Receiver());
1224 1224
1225 rtc::scoped_ptr<VideoEncoder> encoders[kNumStreams]; 1225 std::unique_ptr<VideoEncoder> encoders[kNumStreams];
1226 for (size_t i = 0; i < kNumStreams; ++i) 1226 for (size_t i = 0; i < kNumStreams; ++i)
1227 encoders[i].reset(VideoEncoder::Create(VideoEncoder::kVp8)); 1227 encoders[i].reset(VideoEncoder::Create(VideoEncoder::kVp8));
1228 1228
1229 VideoSendStream* send_streams[kNumStreams]; 1229 VideoSendStream* send_streams[kNumStreams];
1230 VideoReceiveStream* receive_streams[kNumStreams]; 1230 VideoReceiveStream* receive_streams[kNumStreams];
1231 1231
1232 test::FrameGeneratorCapturer* frame_generators[kNumStreams]; 1232 test::FrameGeneratorCapturer* frame_generators[kNumStreams];
1233 ScopedVector<VideoDecoder> allocated_decoders; 1233 ScopedVector<VideoDecoder> allocated_decoders;
1234 for (size_t i = 0; i < kNumStreams; ++i) { 1234 for (size_t i = 0; i < kNumStreams; ++i) {
1235 uint32_t ssrc = codec_settings[i].ssrc; 1235 uint32_t ssrc = codec_settings[i].ssrc;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 frame_generator)); 1367 frame_generator));
1368 } 1368 }
1369 1369
1370 void UpdateReceiveConfig( 1370 void UpdateReceiveConfig(
1371 size_t stream_index, 1371 size_t stream_index,
1372 VideoReceiveStream::Config* receive_config) override { 1372 VideoReceiveStream::Config* receive_config) override {
1373 receive_config->renderer = observers_[stream_index].get(); 1373 receive_config->renderer = observers_[stream_index].get();
1374 } 1374 }
1375 1375
1376 private: 1376 private:
1377 rtc::scoped_ptr<VideoOutputObserver> observers_[kNumStreams]; 1377 std::unique_ptr<VideoOutputObserver> observers_[kNumStreams];
1378 } tester; 1378 } tester;
1379 1379
1380 tester.RunTest(); 1380 tester.RunTest();
1381 } 1381 }
1382 1382
1383 TEST_F(EndToEndTest, AssignsTransportSequenceNumbers) { 1383 TEST_F(EndToEndTest, AssignsTransportSequenceNumbers) {
1384 static const int kExtensionId = 5; 1384 static const int kExtensionId = 5;
1385 1385
1386 class RtpExtensionHeaderObserver : public test::DirectTransport { 1386 class RtpExtensionHeaderObserver : public test::DirectTransport {
1387 public: 1387 public:
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 // Can't be sure until this point that rtx_to_media_ssrcs_ etc have 1485 // Can't be sure until this point that rtx_to_media_ssrcs_ etc have
1486 // been initialized and are OK to read. 1486 // been initialized and are OK to read.
1487 rtc::CritScope cs(&lock_); 1487 rtc::CritScope cs(&lock_);
1488 started_ = true; 1488 started_ = true;
1489 } 1489 }
1490 return done_.Wait(kDefaultTimeoutMs); 1490 return done_.Wait(kDefaultTimeoutMs);
1491 } 1491 }
1492 1492
1493 rtc::CriticalSection lock_; 1493 rtc::CriticalSection lock_;
1494 rtc::Event done_; 1494 rtc::Event done_;
1495 rtc::scoped_ptr<RtpHeaderParser> parser_; 1495 std::unique_ptr<RtpHeaderParser> parser_;
1496 SequenceNumberUnwrapper unwrapper_; 1496 SequenceNumberUnwrapper unwrapper_;
1497 std::set<int64_t> received_packed_ids_; 1497 std::set<int64_t> received_packed_ids_;
1498 std::set<uint32_t> streams_observed_; 1498 std::set<uint32_t> streams_observed_;
1499 std::map<uint32_t, std::set<uint16_t>> dropped_seq_; 1499 std::map<uint32_t, std::set<uint16_t>> dropped_seq_;
1500 const uint32_t& first_media_ssrc_; 1500 const uint32_t& first_media_ssrc_;
1501 const std::map<uint32_t, uint32_t>& rtx_to_media_ssrcs_; 1501 const std::map<uint32_t, uint32_t>& rtx_to_media_ssrcs_;
1502 bool padding_observed_; 1502 bool padding_observed_;
1503 bool rtx_padding_observed_; 1503 bool rtx_padding_observed_;
1504 bool retransmit_observed_; 1504 bool retransmit_observed_;
1505 bool started_; 1505 bool started_;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1699 void ExpectEqualFrames(const EncodedFrameTestObserver& observer) { 1699 void ExpectEqualFrames(const EncodedFrameTestObserver& observer) {
1700 ASSERT_EQ(length_, observer.length_) 1700 ASSERT_EQ(length_, observer.length_)
1701 << "Observed frames are of different lengths."; 1701 << "Observed frames are of different lengths.";
1702 EXPECT_EQ(frame_type_, observer.frame_type_) 1702 EXPECT_EQ(frame_type_, observer.frame_type_)
1703 << "Observed frames have different frame types."; 1703 << "Observed frames have different frame types.";
1704 EXPECT_EQ(0, memcmp(buffer_.get(), observer.buffer_.get(), length_)) 1704 EXPECT_EQ(0, memcmp(buffer_.get(), observer.buffer_.get(), length_))
1705 << "Observed encoded frames have different content."; 1705 << "Observed encoded frames have different content.";
1706 } 1706 }
1707 1707
1708 private: 1708 private:
1709 rtc::scoped_ptr<uint8_t[]> buffer_; 1709 std::unique_ptr<uint8_t[]> buffer_;
1710 size_t length_; 1710 size_t length_;
1711 FrameType frame_type_; 1711 FrameType frame_type_;
1712 rtc::Event called_; 1712 rtc::Event called_;
1713 }; 1713 };
1714 1714
1715 EncodedFrameTestObserver post_encode_observer; 1715 EncodedFrameTestObserver post_encode_observer;
1716 EncodedFrameTestObserver pre_decode_observer; 1716 EncodedFrameTestObserver pre_decode_observer;
1717 1717
1718 CreateCalls(Call::Config(), Call::Config()); 1718 CreateCalls(Call::Config(), Call::Config());
1719 1719
1720 test::DirectTransport sender_transport(sender_call_.get()); 1720 test::DirectTransport sender_transport(sender_call_.get());
1721 test::DirectTransport receiver_transport(receiver_call_.get()); 1721 test::DirectTransport receiver_transport(receiver_call_.get());
1722 sender_transport.SetReceiver(receiver_call_->Receiver()); 1722 sender_transport.SetReceiver(receiver_call_->Receiver());
1723 receiver_transport.SetReceiver(sender_call_->Receiver()); 1723 receiver_transport.SetReceiver(sender_call_->Receiver());
1724 1724
1725 CreateSendConfig(1, 0, &sender_transport); 1725 CreateSendConfig(1, 0, &sender_transport);
1726 CreateMatchingReceiveConfigs(&receiver_transport); 1726 CreateMatchingReceiveConfigs(&receiver_transport);
1727 video_send_config_.post_encode_callback = &post_encode_observer; 1727 video_send_config_.post_encode_callback = &post_encode_observer;
1728 video_receive_configs_[0].pre_decode_callback = &pre_decode_observer; 1728 video_receive_configs_[0].pre_decode_callback = &pre_decode_observer;
1729 1729
1730 CreateVideoStreams(); 1730 CreateVideoStreams();
1731 Start(); 1731 Start();
1732 1732
1733 rtc::scoped_ptr<test::FrameGenerator> frame_generator( 1733 std::unique_ptr<test::FrameGenerator> frame_generator(
1734 test::FrameGenerator::CreateChromaGenerator( 1734 test::FrameGenerator::CreateChromaGenerator(
1735 video_encoder_config_.streams[0].width, 1735 video_encoder_config_.streams[0].width,
1736 video_encoder_config_.streams[0].height)); 1736 video_encoder_config_.streams[0].height));
1737 video_send_stream_->Input()->IncomingCapturedFrame( 1737 video_send_stream_->Input()->IncomingCapturedFrame(
1738 *frame_generator->NextFrame()); 1738 *frame_generator->NextFrame());
1739 1739
1740 EXPECT_TRUE(post_encode_observer.Wait()) 1740 EXPECT_TRUE(post_encode_observer.Wait())
1741 << "Timed out while waiting for send-side encoded-frame callback."; 1741 << "Timed out while waiting for send-side encoded-frame callback.";
1742 1742
1743 EXPECT_TRUE(pre_decode_observer.Wait()) 1743 EXPECT_TRUE(pre_decode_observer.Wait())
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 poller_thread_.Stop(); 1953 poller_thread_.Stop();
1954 } 1954 }
1955 1955
1956 private: 1956 private:
1957 enum TestState { kWaitForFirstRampUp, kWaitForRemb, kWaitForSecondRampUp }; 1957 enum TestState { kWaitForFirstRampUp, kWaitForRemb, kWaitForSecondRampUp };
1958 1958
1959 Call* sender_call_; 1959 Call* sender_call_;
1960 Clock* const clock_; 1960 Clock* const clock_;
1961 uint32_t sender_ssrc_; 1961 uint32_t sender_ssrc_;
1962 int remb_bitrate_bps_; 1962 int remb_bitrate_bps_;
1963 rtc::scoped_ptr<RtpRtcp> rtp_rtcp_; 1963 std::unique_ptr<RtpRtcp> rtp_rtcp_;
1964 test::PacketTransport* receive_transport_; 1964 test::PacketTransport* receive_transport_;
1965 rtc::Event event_; 1965 rtc::Event event_;
1966 rtc::PlatformThread poller_thread_; 1966 rtc::PlatformThread poller_thread_;
1967 TestState state_; 1967 TestState state_;
1968 } test; 1968 } test;
1969 1969
1970 RunBaseTest(&test); 1970 RunBaseTest(&test);
1971 } 1971 }
1972 1972
1973 TEST_F(EndToEndTest, VerifyNackStats) { 1973 TEST_F(EndToEndTest, VerifyNackStats) {
1974 static const int kPacketNumberToDrop = 200; 1974 static const int kPacketNumberToDrop = 200;
1975 class NackObserver : public test::EndToEndTest { 1975 class NackObserver : public test::EndToEndTest {
1976 public: 1976 public:
1977 NackObserver() 1977 NackObserver()
1978 : EndToEndTest(kLongTimeoutMs), 1978 : EndToEndTest(kLongTimeoutMs),
1979 sent_rtp_packets_(0), 1979 sent_rtp_packets_(0),
1980 dropped_rtp_packet_(0), 1980 dropped_rtp_packet_(0),
1981 dropped_rtp_packet_requested_(false), 1981 dropped_rtp_packet_requested_(false),
1982 send_stream_(nullptr), 1982 send_stream_(nullptr),
1983 start_runtime_ms_(-1) {} 1983 start_runtime_ms_(-1) {}
1984 1984
1985 private: 1985 private:
1986 Action OnSendRtp(const uint8_t* packet, size_t length) override { 1986 Action OnSendRtp(const uint8_t* packet, size_t length) override {
1987 rtc::CritScope lock(&crit_); 1987 rtc::CritScope lock(&crit_);
1988 if (++sent_rtp_packets_ == kPacketNumberToDrop) { 1988 if (++sent_rtp_packets_ == kPacketNumberToDrop) {
1989 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); 1989 std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
1990 RTPHeader header; 1990 RTPHeader header;
1991 EXPECT_TRUE(parser->Parse(packet, length, &header)); 1991 EXPECT_TRUE(parser->Parse(packet, length, &header));
1992 dropped_rtp_packet_ = header.sequenceNumber; 1992 dropped_rtp_packet_ = header.sequenceNumber;
1993 return DROP_PACKET; 1993 return DROP_PACKET;
1994 } 1994 }
1995 VerifyStats(); 1995 VerifyStats();
1996 return SEND_PACKET; 1996 return SEND_PACKET;
1997 } 1997 }
1998 1998
1999 Action OnReceiveRtcp(const uint8_t* packet, size_t length) override { 1999 Action OnReceiveRtcp(const uint8_t* packet, size_t length) override {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 receiver_call_ = receiver_call; 2155 receiver_call_ = receiver_call;
2156 } 2156 }
2157 2157
2158 void PerformTest() override { 2158 void PerformTest() override {
2159 EXPECT_TRUE(Wait()) << "Timed out waiting for packet to be NACKed."; 2159 EXPECT_TRUE(Wait()) << "Timed out waiting for packet to be NACKed.";
2160 } 2160 }
2161 2161
2162 const bool use_rtx_; 2162 const bool use_rtx_;
2163 const bool use_red_; 2163 const bool use_red_;
2164 const bool screenshare_; 2164 const bool screenshare_;
2165 const rtc::scoped_ptr<VideoEncoder> vp8_encoder_; 2165 const std::unique_ptr<VideoEncoder> vp8_encoder_;
2166 Call* sender_call_; 2166 Call* sender_call_;
2167 Call* receiver_call_; 2167 Call* receiver_call_;
2168 int64_t start_runtime_ms_; 2168 int64_t start_runtime_ms_;
2169 } test(use_rtx, use_red, screenshare); 2169 } test(use_rtx, use_red, screenshare);
2170 2170
2171 test::ClearHistograms(); 2171 test::ClearHistograms();
2172 RunBaseTest(&test); 2172 RunBaseTest(&test);
2173 2173
2174 // Delete the call for Call stats to be reported. 2174 // Delete the call for Call stats to be reported.
2175 sender_call_.reset(); 2175 sender_call_.reset();
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
3525 private: 3525 private:
3526 bool video_observed_; 3526 bool video_observed_;
3527 bool audio_observed_; 3527 bool audio_observed_;
3528 SequenceNumberUnwrapper unwrapper_; 3528 SequenceNumberUnwrapper unwrapper_;
3529 std::set<int64_t> received_packet_ids_; 3529 std::set<int64_t> received_packet_ids_;
3530 } test; 3530 } test;
3531 3531
3532 RunBaseTest(&test); 3532 RunBaseTest(&test);
3533 } 3533 }
3534 } // namespace webrtc 3534 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/call_stats_unittest.cc ('k') | webrtc/video/overuse_frame_detector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698