OLD | NEW |
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 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 if (config_.logs) | 54 if (config_.logs) |
55 trace_to_stderr_.reset(new test::TraceToStderr); | 55 trace_to_stderr_.reset(new test::TraceToStderr); |
56 | 56 |
57 rtc::scoped_ptr<test::VideoRenderer> local_preview( | 57 rtc::scoped_ptr<test::VideoRenderer> local_preview( |
58 test::VideoRenderer::Create("Local Preview", config_.width, | 58 test::VideoRenderer::Create("Local Preview", config_.width, |
59 config_.height)); | 59 config_.height)); |
60 rtc::scoped_ptr<test::VideoRenderer> loopback_video( | 60 rtc::scoped_ptr<test::VideoRenderer> loopback_video( |
61 test::VideoRenderer::Create("Loopback Video", config_.width, | 61 test::VideoRenderer::Create("Loopback Video", config_.width, |
62 config_.height)); | 62 config_.height)); |
63 | 63 |
64 FakeNetworkPipe::Config pipe_config; | 64 Call::Config call_config; |
65 pipe_config.loss_percent = config_.loss_percent; | |
66 pipe_config.link_capacity_kbps = config_.link_capacity_kbps; | |
67 pipe_config.queue_length_packets = config_.queue_size; | |
68 pipe_config.queue_delay_ms = config_.avg_propagation_delay_ms; | |
69 pipe_config.delay_standard_deviation_ms = config_.std_propagation_delay_ms; | |
70 test::DirectTransport transport(pipe_config); | |
71 Call::Config call_config(&transport); | |
72 | |
73 call_config.bitrate_config.min_bitrate_bps = | 65 call_config.bitrate_config.min_bitrate_bps = |
74 static_cast<int>(config_.min_bitrate_kbps) * 1000; | 66 static_cast<int>(config_.min_bitrate_kbps) * 1000; |
75 call_config.bitrate_config.start_bitrate_bps = | 67 call_config.bitrate_config.start_bitrate_bps = |
76 static_cast<int>(config_.start_bitrate_kbps) * 1000; | 68 static_cast<int>(config_.start_bitrate_kbps) * 1000; |
77 call_config.bitrate_config.max_bitrate_bps = | 69 call_config.bitrate_config.max_bitrate_bps = |
78 static_cast<int>(config_.max_bitrate_kbps) * 1000; | 70 static_cast<int>(config_.max_bitrate_kbps) * 1000; |
79 rtc::scoped_ptr<Call> call(Call::Create(call_config)); | 71 rtc::scoped_ptr<Call> call(Call::Create(call_config)); |
80 | 72 |
| 73 FakeNetworkPipe::Config pipe_config; |
| 74 pipe_config.loss_percent = config_.loss_percent; |
| 75 pipe_config.link_capacity_kbps = config_.link_capacity_kbps; |
| 76 pipe_config.queue_length_packets = config_.queue_size; |
| 77 pipe_config.queue_delay_ms = config_.avg_propagation_delay_ms; |
| 78 pipe_config.delay_standard_deviation_ms = config_.std_propagation_delay_ms; |
| 79 test::DirectTransport send_transport(pipe_config); |
81 // Loopback, call sends to itself. | 80 // Loopback, call sends to itself. |
82 transport.SetReceiver(call->Receiver()); | 81 send_transport.SetReceiver(call->Receiver()); |
83 | 82 |
84 VideoSendStream::Config send_config; | 83 VideoSendStream::Config send_config(&send_transport); |
85 send_config.rtp.ssrcs.push_back(kSendSsrc); | 84 send_config.rtp.ssrcs.push_back(kSendSsrc); |
86 send_config.rtp.rtx.ssrcs.push_back(kSendRtxSsrc); | 85 send_config.rtp.rtx.ssrcs.push_back(kSendRtxSsrc); |
87 send_config.rtp.rtx.payload_type = kRtxVideoPayloadType; | 86 send_config.rtp.rtx.payload_type = kRtxVideoPayloadType; |
88 send_config.rtp.nack.rtp_history_ms = 1000; | 87 send_config.rtp.nack.rtp_history_ms = 1000; |
89 send_config.rtp.extensions.push_back( | 88 send_config.rtp.extensions.push_back( |
90 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeExtensionId)); | 89 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeExtensionId)); |
91 | 90 |
92 send_config.local_renderer = local_preview.get(); | 91 send_config.local_renderer = local_preview.get(); |
93 rtc::scoped_ptr<VideoEncoder> encoder; | 92 rtc::scoped_ptr<VideoEncoder> encoder; |
94 if (config_.codec == "VP8") { | 93 if (config_.codec == "VP8") { |
95 encoder.reset(VideoEncoder::Create(VideoEncoder::kVp8)); | 94 encoder.reset(VideoEncoder::Create(VideoEncoder::kVp8)); |
96 } else if (config_.codec == "VP9") { | 95 } else if (config_.codec == "VP9") { |
97 encoder.reset(VideoEncoder::Create(VideoEncoder::kVp9)); | 96 encoder.reset(VideoEncoder::Create(VideoEncoder::kVp9)); |
98 } else { | 97 } else { |
99 // Codec not supported. | 98 // Codec not supported. |
100 RTC_NOTREACHED() << "Codec not supported!"; | 99 RTC_NOTREACHED() << "Codec not supported!"; |
101 return; | 100 return; |
102 } | 101 } |
103 send_config.encoder_settings.encoder = encoder.get(); | 102 send_config.encoder_settings.encoder = encoder.get(); |
104 send_config.encoder_settings.payload_name = config_.codec; | 103 send_config.encoder_settings.payload_name = config_.codec; |
105 send_config.encoder_settings.payload_type = kVideoPayloadType; | 104 send_config.encoder_settings.payload_type = kVideoPayloadType; |
106 | 105 |
107 VideoEncoderConfig encoder_config(CreateEncoderConfig()); | 106 VideoEncoderConfig encoder_config(CreateEncoderConfig()); |
108 | 107 |
109 VideoSendStream* send_stream = | 108 VideoSendStream* send_stream = |
110 call->CreateVideoSendStream(send_config, encoder_config); | 109 call->CreateVideoSendStream(send_config, encoder_config); |
111 | 110 |
112 rtc::scoped_ptr<test::VideoCapturer> capturer(CreateCapturer(send_stream)); | 111 rtc::scoped_ptr<test::VideoCapturer> capturer(CreateCapturer(send_stream)); |
113 | 112 |
114 VideoReceiveStream::Config receive_config; | 113 VideoReceiveStream::Config receive_config(&send_transport); |
115 receive_config.rtp.remote_ssrc = send_config.rtp.ssrcs[0]; | 114 receive_config.rtp.remote_ssrc = send_config.rtp.ssrcs[0]; |
116 receive_config.rtp.local_ssrc = kReceiverLocalSsrc; | 115 receive_config.rtp.local_ssrc = kReceiverLocalSsrc; |
117 receive_config.rtp.nack.rtp_history_ms = 1000; | 116 receive_config.rtp.nack.rtp_history_ms = 1000; |
118 receive_config.rtp.remb = true; | 117 receive_config.rtp.remb = true; |
119 receive_config.rtp.rtx[kVideoPayloadType].ssrc = kSendRtxSsrc; | 118 receive_config.rtp.rtx[kVideoPayloadType].ssrc = kSendRtxSsrc; |
120 receive_config.rtp.rtx[kVideoPayloadType].payload_type = kRtxVideoPayloadType; | 119 receive_config.rtp.rtx[kVideoPayloadType].payload_type = kRtxVideoPayloadType; |
121 receive_config.rtp.extensions.push_back( | 120 receive_config.rtp.extensions.push_back( |
122 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeExtensionId)); | 121 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeExtensionId)); |
123 receive_config.renderer = loopback_video.get(); | 122 receive_config.renderer = loopback_video.get(); |
124 VideoReceiveStream::Decoder decoder = | 123 VideoReceiveStream::Decoder decoder = |
(...skipping 11 matching lines...) Expand all Loading... |
136 | 135 |
137 capturer->Stop(); | 136 capturer->Stop(); |
138 send_stream->Stop(); | 137 send_stream->Stop(); |
139 receive_stream->Stop(); | 138 receive_stream->Stop(); |
140 | 139 |
141 call->DestroyVideoReceiveStream(receive_stream); | 140 call->DestroyVideoReceiveStream(receive_stream); |
142 call->DestroyVideoSendStream(send_stream); | 141 call->DestroyVideoSendStream(send_stream); |
143 | 142 |
144 delete decoder.decoder; | 143 delete decoder.decoder; |
145 | 144 |
146 transport.StopSending(); | 145 send_transport.StopSending(); |
147 } | 146 } |
148 | 147 |
149 VideoEncoderConfig Loopback::CreateEncoderConfig() { | 148 VideoEncoderConfig Loopback::CreateEncoderConfig() { |
150 VideoEncoderConfig encoder_config; | 149 VideoEncoderConfig encoder_config; |
151 encoder_config.streams = test::CreateVideoStreams(1); | 150 encoder_config.streams = test::CreateVideoStreams(1); |
152 VideoStream* stream = &encoder_config.streams[0]; | 151 VideoStream* stream = &encoder_config.streams[0]; |
153 stream->width = config_.width; | 152 stream->width = config_.width; |
154 stream->height = config_.height; | 153 stream->height = config_.height; |
155 stream->min_bitrate_bps = static_cast<int>(config_.min_bitrate_kbps) * 1000; | 154 stream->min_bitrate_bps = static_cast<int>(config_.min_bitrate_kbps) * 1000; |
156 stream->max_bitrate_bps = static_cast<int>(config_.max_bitrate_kbps) * 1000; | 155 stream->max_bitrate_bps = static_cast<int>(config_.max_bitrate_kbps) * 1000; |
157 stream->target_bitrate_bps = | 156 stream->target_bitrate_bps = |
158 static_cast<int>(config_.max_bitrate_kbps) * 1000; | 157 static_cast<int>(config_.max_bitrate_kbps) * 1000; |
159 stream->max_framerate = config_.fps; | 158 stream->max_framerate = config_.fps; |
160 stream->max_qp = 56; | 159 stream->max_qp = 56; |
161 if (config_.num_temporal_layers != 0) { | 160 if (config_.num_temporal_layers != 0) { |
162 stream->temporal_layer_thresholds_bps.resize(config_.num_temporal_layers - | 161 stream->temporal_layer_thresholds_bps.resize(config_.num_temporal_layers - |
163 1); | 162 1); |
164 } | 163 } |
165 return encoder_config; | 164 return encoder_config; |
166 } | 165 } |
167 | 166 |
168 test::VideoCapturer* Loopback::CreateCapturer(VideoSendStream* send_stream) { | 167 test::VideoCapturer* Loopback::CreateCapturer(VideoSendStream* send_stream) { |
169 return test::VideoCapturer::Create(send_stream->Input(), config_.width, | 168 return test::VideoCapturer::Create(send_stream->Input(), config_.width, |
170 config_.height, config_.fps, clock_); | 169 config_.height, config_.fps, clock_); |
171 } | 170 } |
172 | 171 |
173 } // namespace test | 172 } // namespace test |
174 } // namespace webrtc | 173 } // namespace webrtc |
OLD | NEW |