OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 FakeVideoSendStream::FakeVideoSendStream( | 103 FakeVideoSendStream::FakeVideoSendStream( |
104 webrtc::VideoSendStream::Config config, | 104 webrtc::VideoSendStream::Config config, |
105 webrtc::VideoEncoderConfig encoder_config) | 105 webrtc::VideoEncoderConfig encoder_config) |
106 : sending_(false), | 106 : sending_(false), |
107 config_(std::move(config)), | 107 config_(std::move(config)), |
108 codec_settings_set_(false), | 108 codec_settings_set_(false), |
109 resolution_scaling_enabled_(false), | 109 resolution_scaling_enabled_(false), |
110 source_(nullptr), | 110 source_(nullptr), |
111 num_swapped_frames_(0) { | 111 num_swapped_frames_(0) { |
112 RTC_DCHECK(config.encoder_settings.encoder != NULL); | 112 RTC_DCHECK(config.encoder_settings.encoder != nullptr); |
113 ReconfigureVideoEncoder(std::move(encoder_config)); | 113 ReconfigureVideoEncoder(std::move(encoder_config)); |
114 } | 114 } |
115 | 115 |
116 FakeVideoSendStream::~FakeVideoSendStream() { | 116 FakeVideoSendStream::~FakeVideoSendStream() { |
117 if (source_) | 117 if (source_) |
118 source_->RemoveSink(this); | 118 source_->RemoveSink(this); |
119 } | 119 } |
120 | 120 |
121 const webrtc::VideoSendStream::Config& FakeVideoSendStream::GetConfig() const { | 121 const webrtc::VideoSendStream::Config& FakeVideoSendStream::GetConfig() const { |
122 return config_; | 122 return config_; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 webrtc::VideoEncoderConfig config) { | 205 webrtc::VideoEncoderConfig config) { |
206 int width, height; | 206 int width, height; |
207 if (last_frame_) { | 207 if (last_frame_) { |
208 width = last_frame_->width(); | 208 width = last_frame_->width(); |
209 height = last_frame_->height(); | 209 height = last_frame_->height(); |
210 } else { | 210 } else { |
211 width = height = 0; | 211 width = height = 0; |
212 } | 212 } |
213 video_streams_ = config.video_stream_factory->CreateEncoderStreams( | 213 video_streams_ = config.video_stream_factory->CreateEncoderStreams( |
214 width, height, config); | 214 width, height, config); |
215 if (config.encoder_specific_settings != NULL) { | 215 if (config.encoder_specific_settings != nullptr) { |
216 if (config_.encoder_settings.payload_name == "VP8") { | 216 if (config_.encoder_settings.payload_name == "VP8") { |
217 config.encoder_specific_settings->FillVideoCodecVp8(&vpx_settings_.vp8); | 217 config.encoder_specific_settings->FillVideoCodecVp8(&vpx_settings_.vp8); |
218 if (!video_streams_.empty()) { | 218 if (!video_streams_.empty()) { |
219 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( | 219 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( |
220 video_streams_.back().temporal_layer_thresholds_bps.size() + 1); | 220 video_streams_.back().temporal_layer_thresholds_bps.size() + 1); |
221 } | 221 } |
222 } else if (config_.encoder_settings.payload_name == "VP9") { | 222 } else if (config_.encoder_settings.payload_name == "VP9") { |
223 config.encoder_specific_settings->FillVideoCodecVp9(&vpx_settings_.vp9); | 223 config.encoder_specific_settings->FillVideoCodecVp9(&vpx_settings_.vp9); |
224 if (!video_streams_.empty()) { | 224 if (!video_streams_.empty()) { |
225 vpx_settings_.vp9.numberOfTemporalLayers = static_cast<unsigned char>( | 225 vpx_settings_.vp9.numberOfTemporalLayers = static_cast<unsigned char>( |
226 video_streams_.back().temporal_layer_thresholds_bps.size() + 1); | 226 video_streams_.back().temporal_layer_thresholds_bps.size() + 1); |
227 } | 227 } |
228 } else { | 228 } else { |
229 ADD_FAILURE() << "Unsupported encoder payload: " | 229 ADD_FAILURE() << "Unsupported encoder payload: " |
230 << config_.encoder_settings.payload_name; | 230 << config_.encoder_settings.payload_name; |
231 } | 231 } |
232 } | 232 } |
233 codec_settings_set_ = config.encoder_specific_settings != NULL; | 233 codec_settings_set_ = config.encoder_specific_settings != nullptr; |
234 encoder_config_ = std::move(config); | 234 encoder_config_ = std::move(config); |
235 ++num_encoder_reconfigurations_; | 235 ++num_encoder_reconfigurations_; |
236 } | 236 } |
237 | 237 |
238 void FakeVideoSendStream::Start() { | 238 void FakeVideoSendStream::Start() { |
239 sending_ = true; | 239 sending_ = true; |
240 } | 240 } |
241 | 241 |
242 void FakeVideoSendStream::Stop() { | 242 void FakeVideoSendStream::Stop() { |
243 sending_ = false; | 243 sending_ = false; |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 } | 594 } |
595 | 595 |
596 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { | 596 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { |
597 last_sent_packet_ = sent_packet; | 597 last_sent_packet_ = sent_packet; |
598 if (sent_packet.packet_id >= 0) { | 598 if (sent_packet.packet_id >= 0) { |
599 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; | 599 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; |
600 } | 600 } |
601 } | 601 } |
602 | 602 |
603 } // namespace cricket | 603 } // namespace cricket |
OLD | NEW |