| 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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 uint32_t targetPct = optimalBuffersize * scalePar * codec_.maxFramerate / 10; | 709 uint32_t targetPct = optimalBuffersize * scalePar * codec_.maxFramerate / 10; |
| 710 | 710 |
| 711 // Don't go below 3 times the per frame bandwidth. | 711 // Don't go below 3 times the per frame bandwidth. |
| 712 const uint32_t minIntraTh = 300; | 712 const uint32_t minIntraTh = 300; |
| 713 return (targetPct < minIntraTh) ? minIntraTh: targetPct; | 713 return (targetPct < minIntraTh) ? minIntraTh: targetPct; |
| 714 } | 714 } |
| 715 | 715 |
| 716 int VP8EncoderImpl::Encode(const VideoFrame& frame, | 716 int VP8EncoderImpl::Encode(const VideoFrame& frame, |
| 717 const CodecSpecificInfo* codec_specific_info, | 717 const CodecSpecificInfo* codec_specific_info, |
| 718 const std::vector<FrameType>* frame_types) { | 718 const std::vector<FrameType>* frame_types) { |
| 719 TRACE_EVENT1("webrtc", "VP8::Encode", "timestamp", frame.timestamp()); | |
| 720 | |
| 721 if (!inited_) | 719 if (!inited_) |
| 722 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 720 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
| 723 if (frame.IsZeroSize()) | 721 if (frame.IsZeroSize()) |
| 724 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; | 722 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; |
| 725 if (encoded_complete_callback_ == NULL) | 723 if (encoded_complete_callback_ == NULL) |
| 726 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 724 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
| 727 | 725 |
| 728 if (quality_scaler_enabled_) | 726 if (quality_scaler_enabled_) |
| 729 quality_scaler_.OnEncodeFrame(frame); | 727 quality_scaler_.OnEncodeFrame(frame); |
| 730 const VideoFrame& input_image = | 728 const VideoFrame& input_image = |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 return -1; | 1406 return -1; |
| 1409 } | 1407 } |
| 1410 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) | 1408 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) |
| 1411 != VPX_CODEC_OK) { | 1409 != VPX_CODEC_OK) { |
| 1412 return -1; | 1410 return -1; |
| 1413 } | 1411 } |
| 1414 return 0; | 1412 return 0; |
| 1415 } | 1413 } |
| 1416 | 1414 |
| 1417 } // namespace webrtc | 1415 } // namespace webrtc |
| OLD | NEW |