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 25 matching lines...) Expand all Loading... |
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 | 40 |
41 static const uint32_t kSendSsrc = 0x654321; | 41 static const uint32_t kSendSsrc = 0x654321; |
42 static const uint32_t kSendRtxSsrc = 0x654322; | 42 static const uint32_t kSendRtxSsrc = 0x654322; |
43 static const uint32_t kReceiverLocalSsrc = 0x123456; | 43 static const uint32_t kReceiverLocalSsrc = 0x123456; |
44 | 44 |
45 static const uint8_t kRtxVideoPayloadType = 96; | 45 static const uint8_t kRtxVideoPayloadType = 96; |
| 46 static const uint8_t kVideoPayloadTypeH264 = 126; |
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) |
50 : config_(config), clock_(Clock::GetRealTimeClock()) { | 51 : config_(config), clock_(Clock::GetRealTimeClock()) { |
51 } | 52 } |
52 | 53 |
53 Loopback::~Loopback() { | 54 Loopback::~Loopback() { |
54 } | 55 } |
55 | 56 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; |
96 send_config.rtp.extensions.push_back( | 97 send_config.rtp.extensions.push_back( |
97 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeExtensionId)); | 98 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeExtensionId)); |
98 | 99 |
99 send_config.local_renderer = local_preview.get(); | 100 send_config.local_renderer = local_preview.get(); |
100 rtc::scoped_ptr<VideoEncoder> encoder; | 101 rtc::scoped_ptr<VideoEncoder> encoder; |
101 if (config_.codec == "VP8") { | 102 int payload_type; |
| 103 if (config_.codec == "H264") { |
| 104 encoder.reset(VideoEncoder::Create(VideoEncoder::kH264)); |
| 105 payload_type = kVideoPayloadTypeH264; |
| 106 } else if (config_.codec == "VP8") { |
102 encoder.reset(VideoEncoder::Create(VideoEncoder::kVp8)); | 107 encoder.reset(VideoEncoder::Create(VideoEncoder::kVp8)); |
| 108 payload_type = kVideoPayloadTypeVP8; |
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)); |
| 111 payload_type = kVideoPayloadTypeVP9; |
105 } else { | 112 } else { |
106 // Codec not supported. | 113 // Codec not supported. |
107 RTC_NOTREACHED() << "Codec not supported!"; | 114 RTC_NOTREACHED() << "Codec not supported!"; |
108 return; | 115 return; |
109 } | 116 } |
110 const int payload_type = | |
111 config_.codec == "VP8" ? kVideoPayloadTypeVP8 : kVideoPayloadTypeVP9; | |
112 send_config.encoder_settings.encoder = encoder.get(); | 117 send_config.encoder_settings.encoder = encoder.get(); |
113 send_config.encoder_settings.payload_name = config_.codec; | 118 send_config.encoder_settings.payload_name = config_.codec; |
114 send_config.encoder_settings.payload_type = payload_type; | 119 send_config.encoder_settings.payload_type = payload_type; |
115 | 120 |
116 VideoEncoderConfig encoder_config(CreateEncoderConfig()); | 121 VideoEncoderConfig encoder_config(CreateEncoderConfig()); |
117 | 122 |
118 VideoSendStream* send_stream = | 123 VideoSendStream* send_stream = |
119 call->CreateVideoSendStream(send_config, encoder_config); | 124 call->CreateVideoSendStream(send_config, encoder_config); |
120 | 125 |
121 rtc::scoped_ptr<test::VideoCapturer> capturer(CreateCapturer(send_stream)); | 126 rtc::scoped_ptr<test::VideoCapturer> capturer(CreateCapturer(send_stream)); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 return encoder_config; | 179 return encoder_config; |
175 } | 180 } |
176 | 181 |
177 test::VideoCapturer* Loopback::CreateCapturer(VideoSendStream* send_stream) { | 182 test::VideoCapturer* Loopback::CreateCapturer(VideoSendStream* send_stream) { |
178 return test::VideoCapturer::Create(send_stream->Input(), config_.width, | 183 return test::VideoCapturer::Create(send_stream->Input(), config_.width, |
179 config_.height, config_.fps, clock_); | 184 config_.height, config_.fps, clock_); |
180 } | 185 } |
181 | 186 |
182 } // namespace test | 187 } // namespace test |
183 } // namespace webrtc | 188 } // namespace webrtc |
OLD | NEW |