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