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

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

Issue 1338203003: Wire up send-side bandwidth estimation. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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
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 10
(...skipping 19 matching lines...) Expand all
30 #include "webrtc/test/run_loop.h" 30 #include "webrtc/test/run_loop.h"
31 #include "webrtc/test/testsupport/trace_to_stderr.h" 31 #include "webrtc/test/testsupport/trace_to_stderr.h"
32 #include "webrtc/test/video_capturer.h" 32 #include "webrtc/test/video_capturer.h"
33 #include "webrtc/test/video_renderer.h" 33 #include "webrtc/test/video_renderer.h"
34 #include "webrtc/typedefs.h" 34 #include "webrtc/typedefs.h"
35 35
36 namespace webrtc { 36 namespace webrtc {
37 namespace test { 37 namespace test {
38 38
39 static const int kAbsSendTimeExtensionId = 7; 39 static const int kAbsSendTimeExtensionId = 7;
40 static const int kTransportSeqExtensionId = 8;
40 41
41 static const uint32_t kSendSsrc = 0x654321; 42 static const uint32_t kSendSsrc = 0x654321;
42 static const uint32_t kSendRtxSsrc = 0x654322; 43 static const uint32_t kSendRtxSsrc = 0x654322;
43 static const uint32_t kReceiverLocalSsrc = 0x123456; 44 static const uint32_t kReceiverLocalSsrc = 0x123456;
44 45
45 static const uint8_t kRtxVideoPayloadType = 96; 46 static const uint8_t kRtxVideoPayloadType = 96;
46 static const uint8_t kVideoPayloadTypeVP8 = 124; 47 static const uint8_t kVideoPayloadTypeVP8 = 124;
47 static const uint8_t kVideoPayloadTypeVP9 = 125; 48 static const uint8_t kVideoPayloadTypeVP9 = 125;
48 49
49 Loopback::Loopback(const Config& config) 50 Loopback::Loopback(const Config& config)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 static_cast<uint8_t>(config_.sl_discard_threshold)); 87 static_cast<uint8_t>(config_.sl_discard_threshold));
87 88
88 // Loopback, call sends to itself. 89 // Loopback, call sends to itself.
89 send_transport.SetReceiver(call->Receiver()); 90 send_transport.SetReceiver(call->Receiver());
90 91
91 VideoSendStream::Config send_config(&send_transport); 92 VideoSendStream::Config send_config(&send_transport);
92 send_config.rtp.ssrcs.push_back(kSendSsrc); 93 send_config.rtp.ssrcs.push_back(kSendSsrc);
93 send_config.rtp.rtx.ssrcs.push_back(kSendRtxSsrc); 94 send_config.rtp.rtx.ssrcs.push_back(kSendRtxSsrc);
94 send_config.rtp.rtx.payload_type = kRtxVideoPayloadType; 95 send_config.rtp.rtx.payload_type = kRtxVideoPayloadType;
95 send_config.rtp.nack.rtp_history_ms = 1000; 96 send_config.rtp.nack.rtp_history_ms = 1000;
97 if (config_.send_side_bwe) {
98 send_config.rtp.extensions.push_back(RtpExtension(
99 RtpExtension::kTransportSequenceNumber, kTransportSeqExtensionId));
100 } else {
96 send_config.rtp.extensions.push_back( 101 send_config.rtp.extensions.push_back(
stefan-webrtc 2015/09/17 10:33:19 indentation
sprang_webrtc 2015/09/17 15:08:28 Done.
97 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeExtensionId)); 102 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeExtensionId));
103 }
98 104
99 send_config.local_renderer = local_preview.get(); 105 send_config.local_renderer = local_preview.get();
100 rtc::scoped_ptr<VideoEncoder> encoder; 106 rtc::scoped_ptr<VideoEncoder> encoder;
101 if (config_.codec == "VP8") { 107 if (config_.codec == "VP8") {
102 encoder.reset(VideoEncoder::Create(VideoEncoder::kVp8)); 108 encoder.reset(VideoEncoder::Create(VideoEncoder::kVp8));
103 } else if (config_.codec == "VP9") { 109 } else if (config_.codec == "VP9") {
104 encoder.reset(VideoEncoder::Create(VideoEncoder::kVp9)); 110 encoder.reset(VideoEncoder::Create(VideoEncoder::kVp9));
105 } else { 111 } else {
106 // Codec not supported. 112 // Codec not supported.
107 RTC_NOTREACHED() << "Codec not supported!"; 113 RTC_NOTREACHED() << "Codec not supported!";
(...skipping 12 matching lines...) Expand all
120 126
121 rtc::scoped_ptr<test::VideoCapturer> capturer(CreateCapturer(send_stream)); 127 rtc::scoped_ptr<test::VideoCapturer> capturer(CreateCapturer(send_stream));
122 128
123 VideoReceiveStream::Config receive_config(&send_transport); 129 VideoReceiveStream::Config receive_config(&send_transport);
124 receive_config.rtp.remote_ssrc = send_config.rtp.ssrcs[0]; 130 receive_config.rtp.remote_ssrc = send_config.rtp.ssrcs[0];
125 receive_config.rtp.local_ssrc = kReceiverLocalSsrc; 131 receive_config.rtp.local_ssrc = kReceiverLocalSsrc;
126 receive_config.rtp.nack.rtp_history_ms = 1000; 132 receive_config.rtp.nack.rtp_history_ms = 1000;
127 receive_config.rtp.remb = true; 133 receive_config.rtp.remb = true;
128 receive_config.rtp.rtx[payload_type].ssrc = kSendRtxSsrc; 134 receive_config.rtp.rtx[payload_type].ssrc = kSendRtxSsrc;
129 receive_config.rtp.rtx[payload_type].payload_type = kRtxVideoPayloadType; 135 receive_config.rtp.rtx[payload_type].payload_type = kRtxVideoPayloadType;
130 receive_config.rtp.extensions.push_back( 136 if (config_.send_side_bwe) {
131 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeExtensionId)); 137 receive_config.rtp.extensions.push_back(RtpExtension(
138 RtpExtension::kTransportSequenceNumber, kTransportSeqExtensionId));
139 } else {
140 receive_config.rtp.extensions.push_back(
141 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeExtensionId));
142 receive_config.rtp.remb = true;
143 }
132 receive_config.renderer = loopback_video.get(); 144 receive_config.renderer = loopback_video.get();
133 VideoReceiveStream::Decoder decoder = 145 VideoReceiveStream::Decoder decoder =
134 test::CreateMatchingDecoder(send_config.encoder_settings); 146 test::CreateMatchingDecoder(send_config.encoder_settings);
135 receive_config.decoders.push_back(decoder); 147 receive_config.decoders.push_back(decoder);
136 148
137 VideoReceiveStream* receive_stream = 149 VideoReceiveStream* receive_stream =
138 call->CreateVideoReceiveStream(receive_config); 150 call->CreateVideoReceiveStream(receive_config);
139 151
140 receive_stream->Start(); 152 receive_stream->Start();
141 send_stream->Start(); 153 send_stream->Start();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return encoder_config; 186 return encoder_config;
175 } 187 }
176 188
177 test::VideoCapturer* Loopback::CreateCapturer(VideoSendStream* send_stream) { 189 test::VideoCapturer* Loopback::CreateCapturer(VideoSendStream* send_stream) {
178 return test::VideoCapturer::Create(send_stream->Input(), config_.width, 190 return test::VideoCapturer::Create(send_stream->Input(), config_.width,
179 config_.height, config_.fps, clock_); 191 config_.height, config_.fps, clock_);
180 } 192 }
181 193
182 } // namespace test 194 } // namespace test
183 } // namespace webrtc 195 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698