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

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

Issue 1273363005: Add send transports to individual webrtc::Call streams. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase+comment Created 5 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
« no previous file with comments | « webrtc/video/video_send_stream.cc ('k') | webrtc/video_receive_stream.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> // max 10 #include <algorithm> // max
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 VideoFrame CreateVideoFrame(int width, int height, uint8_t data); 52 VideoFrame CreateVideoFrame(int width, int height, uint8_t data);
53 53
54 class VideoSendStreamTest : public test::CallTest { 54 class VideoSendStreamTest : public test::CallTest {
55 protected: 55 protected:
56 void TestNackRetransmission(uint32_t retransmit_ssrc, 56 void TestNackRetransmission(uint32_t retransmit_ssrc,
57 uint8_t retransmit_payload_type); 57 uint8_t retransmit_payload_type);
58 void TestPacketFragmentationSize(VideoFormat format, bool with_fec); 58 void TestPacketFragmentationSize(VideoFormat format, bool with_fec);
59 }; 59 };
60 60
61 TEST_F(VideoSendStreamTest, CanStartStartedStream) { 61 TEST_F(VideoSendStreamTest, CanStartStartedStream) {
62 test::NullTransport transport; 62 Call::Config call_config;
63 Call::Config call_config(&transport);
64 CreateSenderCall(call_config); 63 CreateSenderCall(call_config);
65 64
66 CreateSendConfig(1); 65 test::NullTransport transport;
66 CreateSendConfig(1, &transport);
67 CreateStreams(); 67 CreateStreams();
68 send_stream_->Start(); 68 send_stream_->Start();
69 send_stream_->Start(); 69 send_stream_->Start();
70 DestroyStreams(); 70 DestroyStreams();
71 } 71 }
72 72
73 TEST_F(VideoSendStreamTest, CanStopStoppedStream) { 73 TEST_F(VideoSendStreamTest, CanStopStoppedStream) {
74 test::NullTransport transport; 74 Call::Config call_config;
75 Call::Config call_config(&transport);
76 CreateSenderCall(call_config); 75 CreateSenderCall(call_config);
77 76
78 CreateSendConfig(1); 77 test::NullTransport transport;
78 CreateSendConfig(1, &transport);
79 CreateStreams(); 79 CreateStreams();
80 send_stream_->Stop(); 80 send_stream_->Stop();
81 send_stream_->Stop(); 81 send_stream_->Stop();
82 DestroyStreams(); 82 DestroyStreams();
83 } 83 }
84 84
85 TEST_F(VideoSendStreamTest, SupportsCName) { 85 TEST_F(VideoSendStreamTest, SupportsCName) {
86 static std::string kCName = "PjQatC14dGfbVwGPUOA9IH7RlsFDbWl4AhXEiDsBizo="; 86 static std::string kCName = "PjQatC14dGfbVwGPUOA9IH7RlsFDbWl4AhXEiDsBizo=";
87 class CNameObserver : public test::SendTest { 87 class CNameObserver : public test::SendTest {
88 public: 88 public:
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 // Increase frame size for next encoded frame, in the context of the 607 // Increase frame size for next encoded frame, in the context of the
608 // encoder thread. 608 // encoder thread.
609 if (!use_fec_ && 609 if (!use_fec_ &&
610 current_size_frame_.Value() < static_cast<int32_t>(stop_size_)) { 610 current_size_frame_.Value() < static_cast<int32_t>(stop_size_)) {
611 ++current_size_frame_; 611 ++current_size_frame_;
612 } 612 }
613 encoder_.SetFrameSize(static_cast<size_t>(current_size_frame_.Value())); 613 encoder_.SetFrameSize(static_cast<size_t>(current_size_frame_.Value()));
614 } 614 }
615 615
616 Call::Config GetSenderCallConfig() override { 616 Call::Config GetSenderCallConfig() override {
617 Call::Config config(SendTransport()); 617 Call::Config config;
618 const int kMinBitrateBps = 30000; 618 const int kMinBitrateBps = 30000;
619 config.bitrate_config.min_bitrate_bps = kMinBitrateBps; 619 config.bitrate_config.min_bitrate_bps = kMinBitrateBps;
620 return config; 620 return config;
621 } 621 }
622 622
623 void ModifyConfigs(VideoSendStream::Config* send_config, 623 void ModifyConfigs(VideoSendStream::Config* send_config,
624 std::vector<VideoReceiveStream::Config>* receive_configs, 624 std::vector<VideoReceiveStream::Config>* receive_configs,
625 VideoEncoderConfig* encoder_config) override { 625 VideoEncoderConfig* encoder_config) override {
626 if (use_fec_) { 626 if (use_fec_) {
627 send_config->rtp.fec.red_payload_type = kRedPayloadType; 627 send_config->rtp.fec.red_payload_type = kRedPayloadType;
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 int GetStartBitrateKbps() const { 1037 int GetStartBitrateKbps() const {
1038 rtc::CritScope lock(&crit_); 1038 rtc::CritScope lock(&crit_);
1039 return start_bitrate_kbps_; 1039 return start_bitrate_kbps_;
1040 } 1040 }
1041 1041
1042 private: 1042 private:
1043 mutable rtc::CriticalSection crit_; 1043 mutable rtc::CriticalSection crit_;
1044 int start_bitrate_kbps_ GUARDED_BY(crit_); 1044 int start_bitrate_kbps_ GUARDED_BY(crit_);
1045 }; 1045 };
1046 1046
1047 CreateSenderCall(Call::Config());
1048
1047 test::NullTransport transport; 1049 test::NullTransport transport;
1048 CreateSenderCall(Call::Config(&transport)); 1050 CreateSendConfig(1, &transport);
1049
1050 CreateSendConfig(1);
1051 1051
1052 Call::Config::BitrateConfig bitrate_config; 1052 Call::Config::BitrateConfig bitrate_config;
1053 bitrate_config.start_bitrate_bps = 1053 bitrate_config.start_bitrate_bps =
1054 2 * encoder_config_.streams[0].max_bitrate_bps; 1054 2 * encoder_config_.streams[0].max_bitrate_bps;
1055 sender_call_->SetBitrateConfig(bitrate_config); 1055 sender_call_->SetBitrateConfig(bitrate_config);
1056 1056
1057 StartBitrateObserver encoder; 1057 StartBitrateObserver encoder;
1058 send_config_.encoder_settings.encoder = &encoder; 1058 send_config_.encoder_settings.encoder = &encoder;
1059 1059
1060 CreateStreams(); 1060 CreateStreams();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 1097
1098 private: 1098 private:
1099 // Delivered output frames. 1099 // Delivered output frames.
1100 std::vector<VideoFrame> output_frames_; 1100 std::vector<VideoFrame> output_frames_;
1101 1101
1102 // Indicate an output frame has arrived. 1102 // Indicate an output frame has arrived.
1103 rtc::scoped_ptr<EventWrapper> output_frame_event_; 1103 rtc::scoped_ptr<EventWrapper> output_frame_event_;
1104 }; 1104 };
1105 1105
1106 // Initialize send stream. 1106 // Initialize send stream.
1107 CreateSenderCall(Call::Config());
1108
1107 test::NullTransport transport; 1109 test::NullTransport transport;
1108 CreateSenderCall(Call::Config(&transport)); 1110 CreateSendConfig(1, &transport);
1109
1110 CreateSendConfig(1);
1111 FrameObserver observer; 1111 FrameObserver observer;
1112 send_config_.pre_encode_callback = &observer; 1112 send_config_.pre_encode_callback = &observer;
1113 CreateStreams(); 1113 CreateStreams();
1114 1114
1115 // Prepare five input frames. Send ordinary VideoFrame and texture frames 1115 // Prepare five input frames. Send ordinary VideoFrame and texture frames
1116 // alternatively. 1116 // alternatively.
1117 std::vector<VideoFrame> input_frames; 1117 std::vector<VideoFrame> input_frames;
1118 int width = static_cast<int>(encoder_config_.streams[0].width); 1118 int width = static_cast<int>(encoder_config_.streams[0].width);
1119 int height = static_cast<int>(encoder_config_.streams[0].height); 1119 int height = static_cast<int>(encoder_config_.streams[0].height);
1120 test::FakeNativeHandle* handle1 = new test::FakeNativeHandle(); 1120 test::FakeNativeHandle* handle1 = new test::FakeNativeHandle();
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 codecSettings->maxBitrate); 1652 codecSettings->maxBitrate);
1653 EXPECT_EQ(static_cast<unsigned int>(kIncreasedStartBitrateKbps), 1653 EXPECT_EQ(static_cast<unsigned int>(kIncreasedStartBitrateKbps),
1654 codecSettings->startBitrate); 1654 codecSettings->startBitrate);
1655 } 1655 }
1656 ++num_initializations_; 1656 ++num_initializations_;
1657 return FakeEncoder::InitEncode(codecSettings, numberOfCores, 1657 return FakeEncoder::InitEncode(codecSettings, numberOfCores,
1658 maxPayloadSize); 1658 maxPayloadSize);
1659 } 1659 }
1660 1660
1661 Call::Config GetSenderCallConfig() override { 1661 Call::Config GetSenderCallConfig() override {
1662 Call::Config config(SendTransport()); 1662 Call::Config config;
1663 config.bitrate_config.min_bitrate_bps = kMinBitrateKbps * 1000; 1663 config.bitrate_config.min_bitrate_bps = kMinBitrateKbps * 1000;
1664 config.bitrate_config.start_bitrate_bps = kStartBitrateKbps * 1000; 1664 config.bitrate_config.start_bitrate_bps = kStartBitrateKbps * 1000;
1665 config.bitrate_config.max_bitrate_bps = kMaxBitrateKbps * 1000; 1665 config.bitrate_config.max_bitrate_bps = kMaxBitrateKbps * 1000;
1666 return config; 1666 return config;
1667 } 1667 }
1668 1668
1669 void ModifyConfigs(VideoSendStream::Config* send_config, 1669 void ModifyConfigs(VideoSendStream::Config* send_config,
1670 std::vector<VideoReceiveStream::Config>* receive_configs, 1670 std::vector<VideoReceiveStream::Config>* receive_configs,
1671 VideoEncoderConfig* encoder_config) override { 1671 VideoEncoderConfig* encoder_config) override {
1672 send_config->encoder_settings.encoder = this; 1672 send_config->encoder_settings.encoder = this;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 const std::vector<VideoReceiveStream*>& receive_streams) override { 1789 const std::vector<VideoReceiveStream*>& receive_streams) override {
1790 send_stream_ = send_stream; 1790 send_stream_ = send_stream;
1791 } 1791 }
1792 1792
1793 VideoSendStream* send_stream_; 1793 VideoSendStream* send_stream_;
1794 } test; 1794 } test;
1795 1795
1796 RunBaseTest(&test); 1796 RunBaseTest(&test);
1797 } 1797 }
1798 } // namespace webrtc 1798 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_send_stream.cc ('k') | webrtc/video_receive_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698