OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 int VideoProcessor::NumberDroppedFrames() { | 279 int VideoProcessor::NumberDroppedFrames() { |
280 RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_); | 280 RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_); |
281 return num_dropped_frames_; | 281 return num_dropped_frames_; |
282 } | 282 } |
283 | 283 |
284 int VideoProcessor::NumberSpatialResizes() { | 284 int VideoProcessor::NumberSpatialResizes() { |
285 RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_); | 285 RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_); |
286 return num_spatial_resizes_; | 286 return num_spatial_resizes_; |
287 } | 287 } |
288 | 288 |
289 void VideoProcessor::FrameEncoded( | 289 void VideoProcessor::FrameEncoded(webrtc::VideoCodecType codec, |
290 webrtc::VideoCodecType codec, | 290 const EncodedImage& encoded_image) { |
291 const EncodedImage& encoded_image, | |
292 const webrtc::RTPFragmentationHeader* fragmentation) { | |
293 RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_); | 291 RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_); |
294 | 292 |
295 // For the highest measurement accuracy of the encode time, the start/stop | 293 // For the highest measurement accuracy of the encode time, the start/stop |
296 // time recordings should wrap the Encode call as tightly as possible. | 294 // time recordings should wrap the Encode call as tightly as possible. |
297 int64_t encode_stop_ns = rtc::TimeNanos(); | 295 int64_t encode_stop_ns = rtc::TimeNanos(); |
298 | 296 |
299 if (encoded_frame_writer_) { | 297 if (encoded_frame_writer_) { |
300 RTC_CHECK(encoded_frame_writer_->WriteFrame(encoded_image, codec)); | 298 RTC_CHECK(encoded_frame_writer_->WriteFrame(encoded_image, codec)); |
301 } | 299 } |
302 | 300 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 memcpy(&copied_image, &encoded_image, sizeof(copied_image)); | 386 memcpy(&copied_image, &encoded_image, sizeof(copied_image)); |
389 copied_image._size = copied_buffer_size; | 387 copied_image._size = copied_buffer_size; |
390 copied_image._buffer = copied_buffer.get(); | 388 copied_image._buffer = copied_buffer.get(); |
391 | 389 |
392 if (!exclude_this_frame) { | 390 if (!exclude_this_frame) { |
393 frame_stat->packets_dropped = | 391 frame_stat->packets_dropped = |
394 packet_manipulator_->ManipulatePackets(&copied_image); | 392 packet_manipulator_->ManipulatePackets(&copied_image); |
395 } | 393 } |
396 frame_info->manipulated_length = copied_image._length; | 394 frame_info->manipulated_length = copied_image._length; |
397 | 395 |
398 // Keep track of if frames are lost due to packet loss so we can tell | |
399 // this to the encoder (this is handled by the RTP logic in the full stack). | |
400 // TODO(kjellander): Pass fragmentation header to the decoder when | |
401 // CL 172001 has been submitted and PacketManipulator supports this. | |
402 | |
403 // For the highest measurement accuracy of the decode time, the start/stop | 396 // For the highest measurement accuracy of the decode time, the start/stop |
404 // time recordings should wrap the Decode call as tightly as possible. | 397 // time recordings should wrap the Decode call as tightly as possible. |
405 frame_info->decode_start_ns = rtc::TimeNanos(); | 398 frame_info->decode_start_ns = rtc::TimeNanos(); |
406 frame_stat->decode_return_code = | 399 frame_stat->decode_return_code = |
407 decoder_->Decode(copied_image, last_frame_missing, nullptr); | 400 decoder_->Decode(copied_image, last_frame_missing, nullptr); |
408 | 401 |
409 if (frame_stat->decode_return_code != WEBRTC_VIDEO_CODEC_OK) { | 402 if (frame_stat->decode_return_code != WEBRTC_VIDEO_CODEC_OK) { |
410 // Write the last successful frame the output file to avoid getting it out | 403 // Write the last successful frame the output file to avoid getting it out |
411 // of sync with the source file for SSIM and PSNR comparisons. | 404 // of sync with the source file for SSIM and PSNR comparisons. |
412 RTC_DCHECK_EQ(last_decoded_frame_buffer_.size(), | 405 RTC_DCHECK_EQ(last_decoded_frame_buffer_.size(), |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 | 499 |
507 RTC_DCHECK_GT(timestamp, 0); | 500 RTC_DCHECK_GT(timestamp, 0); |
508 const int ticks_per_frame = | 501 const int ticks_per_frame = |
509 kRtpClockRateHz / config_.codec_settings.maxFramerate; | 502 kRtpClockRateHz / config_.codec_settings.maxFramerate; |
510 RTC_DCHECK_EQ(timestamp % ticks_per_frame, 0); | 503 RTC_DCHECK_EQ(timestamp % ticks_per_frame, 0); |
511 return (timestamp / ticks_per_frame) - 1; | 504 return (timestamp / ticks_per_frame) - 1; |
512 } | 505 } |
513 | 506 |
514 } // namespace test | 507 } // namespace test |
515 } // namespace webrtc | 508 } // namespace webrtc |
OLD | NEW |