| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 const webrtc::VideoSendStream::Config& FakeVideoSendStream::GetConfig() const { | 118 const webrtc::VideoSendStream::Config& FakeVideoSendStream::GetConfig() const { |
| 119 return config_; | 119 return config_; |
| 120 } | 120 } |
| 121 | 121 |
| 122 const webrtc::VideoEncoderConfig& FakeVideoSendStream::GetEncoderConfig() | 122 const webrtc::VideoEncoderConfig& FakeVideoSendStream::GetEncoderConfig() |
| 123 const { | 123 const { |
| 124 return encoder_config_; | 124 return encoder_config_; |
| 125 } | 125 } |
| 126 | 126 |
| 127 std::vector<webrtc::VideoStream> FakeVideoSendStream::GetVideoStreams() { | 127 const std::vector<webrtc::VideoStream>& FakeVideoSendStream::GetVideoStreams() |
| 128 return encoder_config_.streams; | 128 const { |
| 129 return video_streams_; |
| 129 } | 130 } |
| 130 | 131 |
| 131 bool FakeVideoSendStream::IsSending() const { | 132 bool FakeVideoSendStream::IsSending() const { |
| 132 return sending_; | 133 return sending_; |
| 133 } | 134 } |
| 134 | 135 |
| 135 bool FakeVideoSendStream::GetVp8Settings( | 136 bool FakeVideoSendStream::GetVp8Settings( |
| 136 webrtc::VideoCodecVP8* settings) const { | 137 webrtc::VideoCodecVP8* settings) const { |
| 137 if (!codec_settings_set_) { | 138 if (!codec_settings_set_) { |
| 138 return false; | 139 return false; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 164 return last_frame_.height(); | 165 return last_frame_.height(); |
| 165 } | 166 } |
| 166 | 167 |
| 167 int64_t FakeVideoSendStream::GetLastTimestamp() const { | 168 int64_t FakeVideoSendStream::GetLastTimestamp() const { |
| 168 RTC_DCHECK(last_frame_.ntp_time_ms() == 0); | 169 RTC_DCHECK(last_frame_.ntp_time_ms() == 0); |
| 169 return last_frame_.render_time_ms(); | 170 return last_frame_.render_time_ms(); |
| 170 } | 171 } |
| 171 | 172 |
| 172 void FakeVideoSendStream::OnFrame(const webrtc::VideoFrame& frame) { | 173 void FakeVideoSendStream::OnFrame(const webrtc::VideoFrame& frame) { |
| 173 ++num_swapped_frames_; | 174 ++num_swapped_frames_; |
| 175 if (frame.width() != last_frame_.width() || |
| 176 frame.height() != last_frame_.height() || |
| 177 frame.rotation() != last_frame_.rotation()) { |
| 178 video_streams_ = encoder_config_.video_stream_factory->CreateEncoderStreams( |
| 179 frame.width(), frame.height(), encoder_config_); |
| 180 } |
| 174 last_frame_.ShallowCopy(frame); | 181 last_frame_.ShallowCopy(frame); |
| 175 } | 182 } |
| 176 | 183 |
| 177 void FakeVideoSendStream::SetStats( | 184 void FakeVideoSendStream::SetStats( |
| 178 const webrtc::VideoSendStream::Stats& stats) { | 185 const webrtc::VideoSendStream::Stats& stats) { |
| 179 stats_ = stats; | 186 stats_ = stats; |
| 180 } | 187 } |
| 181 | 188 |
| 182 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { | 189 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { |
| 183 return stats_; | 190 return stats_; |
| 184 } | 191 } |
| 185 | 192 |
| 186 void FakeVideoSendStream::EnableEncodedFrameRecording( | 193 void FakeVideoSendStream::EnableEncodedFrameRecording( |
| 187 const std::vector<rtc::PlatformFile>& files, | 194 const std::vector<rtc::PlatformFile>& files, |
| 188 size_t byte_limit) { | 195 size_t byte_limit) { |
| 189 for (rtc::PlatformFile file : files) | 196 for (rtc::PlatformFile file : files) |
| 190 rtc::ClosePlatformFile(file); | 197 rtc::ClosePlatformFile(file); |
| 191 } | 198 } |
| 192 | 199 |
| 193 void FakeVideoSendStream::ReconfigureVideoEncoder( | 200 void FakeVideoSendStream::ReconfigureVideoEncoder( |
| 194 webrtc::VideoEncoderConfig config) { | 201 webrtc::VideoEncoderConfig config) { |
| 202 video_streams_ = config.video_stream_factory->CreateEncoderStreams( |
| 203 last_frame_.width(), last_frame_.height(), config); |
| 195 if (config.encoder_specific_settings != NULL) { | 204 if (config.encoder_specific_settings != NULL) { |
| 196 if (config_.encoder_settings.payload_name == "VP8") { | 205 if (config_.encoder_settings.payload_name == "VP8") { |
| 197 config.encoder_specific_settings->FillVideoCodecVp8(&vpx_settings_.vp8); | 206 config.encoder_specific_settings->FillVideoCodecVp8(&vpx_settings_.vp8); |
| 198 if (!config.streams.empty()) { | 207 if (!video_streams_.empty()) { |
| 199 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( | 208 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( |
| 200 config.streams.back().temporal_layer_thresholds_bps.size() + 1); | 209 video_streams_.back().temporal_layer_thresholds_bps.size() + 1); |
| 201 } | 210 } |
| 202 } else if (config_.encoder_settings.payload_name == "VP9") { | 211 } else if (config_.encoder_settings.payload_name == "VP9") { |
| 203 config.encoder_specific_settings->FillVideoCodecVp9(&vpx_settings_.vp9); | 212 config.encoder_specific_settings->FillVideoCodecVp9(&vpx_settings_.vp9); |
| 204 if (!config.streams.empty()) { | 213 if (!video_streams_.empty()) { |
| 205 vpx_settings_.vp9.numberOfTemporalLayers = static_cast<unsigned char>( | 214 vpx_settings_.vp9.numberOfTemporalLayers = static_cast<unsigned char>( |
| 206 config.streams.back().temporal_layer_thresholds_bps.size() + 1); | 215 video_streams_.back().temporal_layer_thresholds_bps.size() + 1); |
| 207 } | 216 } |
| 208 } else { | 217 } else { |
| 209 ADD_FAILURE() << "Unsupported encoder payload: " | 218 ADD_FAILURE() << "Unsupported encoder payload: " |
| 210 << config_.encoder_settings.payload_name; | 219 << config_.encoder_settings.payload_name; |
| 211 } | 220 } |
| 212 } | 221 } |
| 213 codec_settings_set_ = config.encoder_specific_settings != NULL; | 222 codec_settings_set_ = config.encoder_specific_settings != NULL; |
| 214 encoder_config_ = std::move(config); | 223 encoder_config_ = std::move(config); |
| 215 ++num_encoder_reconfigurations_; | 224 ++num_encoder_reconfigurations_; |
| 216 } | 225 } |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 } | 511 } |
| 503 | 512 |
| 504 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, | 513 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, |
| 505 int64_t max_size_bytes) { | 514 int64_t max_size_bytes) { |
| 506 return false; | 515 return false; |
| 507 } | 516 } |
| 508 | 517 |
| 509 void FakeCall::StopEventLog() {} | 518 void FakeCall::StopEventLog() {} |
| 510 | 519 |
| 511 } // namespace cricket | 520 } // namespace cricket |
| OLD | NEW |