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 (frame.width() != last_frame_.width() || | 178 if (!last_frame_ || |
179 frame.height() != last_frame_.height() || | 179 frame.width() != last_frame_->width() || |
180 frame.rotation() != last_frame_.rotation()) { | 180 frame.height() != last_frame_->height() || |
| 181 frame.rotation() != last_frame_->rotation()) { |
181 video_streams_ = encoder_config_.video_stream_factory->CreateEncoderStreams( | 182 video_streams_ = encoder_config_.video_stream_factory->CreateEncoderStreams( |
182 frame.width(), frame.height(), encoder_config_); | 183 frame.width(), frame.height(), encoder_config_); |
183 } | 184 } |
184 last_frame_ = frame; | 185 last_frame_ = rtc::Optional<webrtc::VideoFrame>(frame); |
185 } | 186 } |
186 | 187 |
187 void FakeVideoSendStream::SetStats( | 188 void FakeVideoSendStream::SetStats( |
188 const webrtc::VideoSendStream::Stats& stats) { | 189 const webrtc::VideoSendStream::Stats& stats) { |
189 stats_ = stats; | 190 stats_ = stats; |
190 } | 191 } |
191 | 192 |
192 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { | 193 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { |
193 return stats_; | 194 return stats_; |
194 } | 195 } |
195 | 196 |
196 void FakeVideoSendStream::EnableEncodedFrameRecording( | 197 void FakeVideoSendStream::EnableEncodedFrameRecording( |
197 const std::vector<rtc::PlatformFile>& files, | 198 const std::vector<rtc::PlatformFile>& files, |
198 size_t byte_limit) { | 199 size_t byte_limit) { |
199 for (rtc::PlatformFile file : files) | 200 for (rtc::PlatformFile file : files) |
200 rtc::ClosePlatformFile(file); | 201 rtc::ClosePlatformFile(file); |
201 } | 202 } |
202 | 203 |
203 void FakeVideoSendStream::ReconfigureVideoEncoder( | 204 void FakeVideoSendStream::ReconfigureVideoEncoder( |
204 webrtc::VideoEncoderConfig config) { | 205 webrtc::VideoEncoderConfig config) { |
205 video_streams_ = config.video_stream_factory->CreateEncoderStreams( | 206 video_streams_ = config.video_stream_factory->CreateEncoderStreams( |
206 last_frame_.width(), last_frame_.height(), config); | 207 last_frame_->width(), last_frame_->height(), config); |
207 if (config.encoder_specific_settings != NULL) { | 208 if (config.encoder_specific_settings != NULL) { |
208 if (config_.encoder_settings.payload_name == "VP8") { | 209 if (config_.encoder_settings.payload_name == "VP8") { |
209 config.encoder_specific_settings->FillVideoCodecVp8(&vpx_settings_.vp8); | 210 config.encoder_specific_settings->FillVideoCodecVp8(&vpx_settings_.vp8); |
210 if (!video_streams_.empty()) { | 211 if (!video_streams_.empty()) { |
211 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( | 212 vpx_settings_.vp8.numberOfTemporalLayers = static_cast<unsigned char>( |
212 video_streams_.back().temporal_layer_thresholds_bps.size() + 1); | 213 video_streams_.back().temporal_layer_thresholds_bps.size() + 1); |
213 } | 214 } |
214 } else if (config_.encoder_settings.payload_name == "VP9") { | 215 } else if (config_.encoder_settings.payload_name == "VP9") { |
215 config.encoder_specific_settings->FillVideoCodecVp9(&vpx_settings_.vp9); | 216 config.encoder_specific_settings->FillVideoCodecVp9(&vpx_settings_.vp9); |
216 if (!video_streams_.empty()) { | 217 if (!video_streams_.empty()) { |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 } | 584 } |
584 | 585 |
585 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { | 586 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { |
586 last_sent_packet_ = sent_packet; | 587 last_sent_packet_ = sent_packet; |
587 if (sent_packet.packet_id >= 0) { | 588 if (sent_packet.packet_id >= 0) { |
588 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; | 589 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; |
589 } | 590 } |
590 } | 591 } |
591 | 592 |
592 } // namespace cricket | 593 } // namespace cricket |
OLD | NEW |