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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 *settings = vpx_settings_.vp9; | 155 *settings = vpx_settings_.vp9; |
156 return true; | 156 return true; |
157 } | 157 } |
158 | 158 |
159 int FakeVideoSendStream::GetNumberOfSwappedFrames() const { | 159 int FakeVideoSendStream::GetNumberOfSwappedFrames() const { |
160 return num_swapped_frames_; | 160 return num_swapped_frames_; |
161 } | 161 } |
162 | 162 |
163 int FakeVideoSendStream::GetLastWidth() const { | 163 int FakeVideoSendStream::GetLastWidth() const { |
164 return last_frame_->width(); | 164 return last_frame_.width(); |
165 } | 165 } |
166 | 166 |
167 int FakeVideoSendStream::GetLastHeight() const { | 167 int FakeVideoSendStream::GetLastHeight() const { |
168 return last_frame_->height(); | 168 return last_frame_.height(); |
169 } | 169 } |
170 | 170 |
171 int64_t FakeVideoSendStream::GetLastTimestamp() const { | 171 int64_t FakeVideoSendStream::GetLastTimestamp() const { |
172 RTC_DCHECK(last_frame_->ntp_time_ms() == 0); | 172 RTC_DCHECK(last_frame_.ntp_time_ms() == 0); |
173 return last_frame_->render_time_ms(); | 173 return last_frame_.render_time_ms(); |
174 } | 174 } |
175 | 175 |
176 void FakeVideoSendStream::OnFrame(const webrtc::VideoFrame& frame) { | 176 void FakeVideoSendStream::OnFrame(const webrtc::VideoFrame& frame) { |
177 ++num_swapped_frames_; | 177 ++num_swapped_frames_; |
178 if (!last_frame_ || | 178 if (frame.width() != last_frame_.width() || |
179 frame.width() != last_frame_->width() || | 179 frame.height() != last_frame_.height() || |
180 frame.height() != last_frame_->height() || | 180 frame.rotation() != last_frame_.rotation()) { |
181 frame.rotation() != last_frame_->rotation()) { | |
182 video_streams_ = encoder_config_.video_stream_factory->CreateEncoderStreams( | 181 video_streams_ = encoder_config_.video_stream_factory->CreateEncoderStreams( |
183 frame.width(), frame.height(), encoder_config_); | 182 frame.width(), frame.height(), encoder_config_); |
184 } | 183 } |
185 last_frame_ = rtc::Optional<webrtc::VideoFrame>(frame); | 184 last_frame_ = frame; |
186 } | 185 } |
187 | 186 |
188 void FakeVideoSendStream::SetStats( | 187 void FakeVideoSendStream::SetStats( |
189 const webrtc::VideoSendStream::Stats& stats) { | 188 const webrtc::VideoSendStream::Stats& stats) { |
190 stats_ = stats; | 189 stats_ = stats; |
191 } | 190 } |
192 | 191 |
193 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { | 192 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { |
194 return stats_; | 193 return stats_; |
195 } | 194 } |
196 | 195 |
197 void FakeVideoSendStream::EnableEncodedFrameRecording( | 196 void FakeVideoSendStream::EnableEncodedFrameRecording( |
198 const std::vector<rtc::PlatformFile>& files, | 197 const std::vector<rtc::PlatformFile>& files, |
199 size_t byte_limit) { | 198 size_t byte_limit) { |
200 for (rtc::PlatformFile file : files) | 199 for (rtc::PlatformFile file : files) |
201 rtc::ClosePlatformFile(file); | 200 rtc::ClosePlatformFile(file); |
202 } | 201 } |
203 | 202 |
204 void FakeVideoSendStream::ReconfigureVideoEncoder( | 203 void FakeVideoSendStream::ReconfigureVideoEncoder( |
205 webrtc::VideoEncoderConfig config) { | 204 webrtc::VideoEncoderConfig config) { |
206 int width, height; | |
207 if (last_frame_) { | |
208 width = last_frame_->width(); | |
209 height = last_frame_->height(); | |
210 } else { | |
211 width = height = 0; | |
212 } | |
213 video_streams_ = config.video_stream_factory->CreateEncoderStreams( | 205 video_streams_ = config.video_stream_factory->CreateEncoderStreams( |
214 width, height, config); | 206 last_frame_.width(), last_frame_.height(), config); |
215 if (config.encoder_specific_settings != NULL) { | 207 if (config.encoder_specific_settings != NULL) { |
216 if (config_.encoder_settings.payload_name == "VP8") { | 208 if (config_.encoder_settings.payload_name == "VP8") { |
217 config.encoder_specific_settings->FillVideoCodecVp8(&vpx_settings_.vp8); | 209 config.encoder_specific_settings->FillVideoCodecVp8(&vpx_settings_.vp8); |
218 if (!video_streams_.empty()) { | 210 if (!video_streams_.empty()) { |
219 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( | 211 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( |
220 video_streams_.back().temporal_layer_thresholds_bps.size() + 1); | 212 video_streams_.back().temporal_layer_thresholds_bps.size() + 1); |
221 } | 213 } |
222 } else if (config_.encoder_settings.payload_name == "VP9") { | 214 } else if (config_.encoder_settings.payload_name == "VP9") { |
223 config.encoder_specific_settings->FillVideoCodecVp9(&vpx_settings_.vp9); | 215 config.encoder_specific_settings->FillVideoCodecVp9(&vpx_settings_.vp9); |
224 if (!video_streams_.empty()) { | 216 if (!video_streams_.empty()) { |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 } | 582 } |
591 | 583 |
592 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { | 584 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { |
593 last_sent_packet_ = sent_packet; | 585 last_sent_packet_ = sent_packet; |
594 if (sent_packet.packet_id >= 0) { | 586 if (sent_packet.packet_id >= 0) { |
595 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; | 587 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; |
596 } | 588 } |
597 } | 589 } |
598 | 590 |
599 } // namespace cricket | 591 } // namespace cricket |
OLD | NEW |