| 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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 float scalePar = 0.5; | 690 float scalePar = 0.5; |
| 691 uint32_t targetPct = optimalBuffersize * scalePar * codec_.maxFramerate / 10; | 691 uint32_t targetPct = optimalBuffersize * scalePar * codec_.maxFramerate / 10; |
| 692 | 692 |
| 693 // Don't go below 3 times the per frame bandwidth. | 693 // Don't go below 3 times the per frame bandwidth. |
| 694 const uint32_t minIntraTh = 300; | 694 const uint32_t minIntraTh = 300; |
| 695 return (targetPct < minIntraTh) ? minIntraTh: targetPct; | 695 return (targetPct < minIntraTh) ? minIntraTh: targetPct; |
| 696 } | 696 } |
| 697 | 697 |
| 698 int VP8EncoderImpl::Encode(const VideoFrame& frame, | 698 int VP8EncoderImpl::Encode(const VideoFrame& frame, |
| 699 const CodecSpecificInfo* codec_specific_info, | 699 const CodecSpecificInfo* codec_specific_info, |
| 700 const std::vector<VideoFrameType>* frame_types) { | 700 const std::vector<FrameType>* frame_types) { |
| 701 TRACE_EVENT1("webrtc", "VP8::Encode", "timestamp", frame.timestamp()); | 701 TRACE_EVENT1("webrtc", "VP8::Encode", "timestamp", frame.timestamp()); |
| 702 | 702 |
| 703 if (!inited_) | 703 if (!inited_) |
| 704 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 704 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
| 705 if (frame.IsZeroSize()) | 705 if (frame.IsZeroSize()) |
| 706 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; | 706 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; |
| 707 if (encoded_complete_callback_ == NULL) | 707 if (encoded_complete_callback_ == NULL) |
| 708 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 708 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
| 709 | 709 |
| 710 // Only apply scaling to improve for single-layer streams. The scaling metrics | 710 // Only apply scaling to improve for single-layer streams. The scaling metrics |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 return -1; | 1396 return -1; |
| 1397 } | 1397 } |
| 1398 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) | 1398 if (vpx_codec_control(copy->decoder_, VP8_SET_REFERENCE, ref_frame_) |
| 1399 != VPX_CODEC_OK) { | 1399 != VPX_CODEC_OK) { |
| 1400 return -1; | 1400 return -1; |
| 1401 } | 1401 } |
| 1402 return 0; | 1402 return 0; |
| 1403 } | 1403 } |
| 1404 | 1404 |
| 1405 } // namespace webrtc | 1405 } // namespace webrtc |
| OLD | NEW |