OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // | 46 // |
47 // Input: | 47 // Input: |
48 // - frameSizeBytes : The size of the latest frame | 48 // - frameSizeBytes : The size of the latest frame |
49 // returned from the encoder. | 49 // returned from the encoder. |
50 // - deltaFrame : True if the encoder returned | 50 // - deltaFrame : True if the encoder returned |
51 // a key frame. | 51 // a key frame. |
52 virtual void Fill(size_t frameSizeBytes, bool deltaFrame); | 52 virtual void Fill(size_t frameSizeBytes, bool deltaFrame); |
53 | 53 |
54 virtual void Leak(uint32_t inputFrameRate); | 54 virtual void Leak(uint32_t inputFrameRate); |
55 | 55 |
56 void UpdateNack(uint32_t nackBytes); | |
57 | |
58 // Sets the target bit rate and the frame rate produced by | 56 // Sets the target bit rate and the frame rate produced by |
59 // the camera. | 57 // the camera. |
60 // | 58 // |
61 // Input: | 59 // Input: |
62 // - bitRate : The target bit rate | 60 // - bitRate : The target bit rate |
63 virtual void SetRates(float bitRate, float incoming_frame_rate); | 61 virtual void SetRates(float bitRate, float incoming_frame_rate); |
64 | 62 |
65 // Return value : The current average frame rate produced | |
66 // if the DropFrame() function is used as | |
67 // instruction of when to drop frames. | |
68 virtual float ActualFrameRate(uint32_t inputFrameRate) const; | |
69 | |
70 private: | 63 private: |
71 void FillBucket(float inKbits, float outKbits); | |
72 void UpdateRatio(); | 64 void UpdateRatio(); |
73 void CapAccumulator(); | 65 void CapAccumulator(); |
74 | 66 |
75 rtc::ExpFilter _keyFrameSizeAvgKbits; | 67 rtc::ExpFilter key_frame_size_avg_kbits_; |
76 rtc::ExpFilter _keyFrameRatio; | 68 rtc::ExpFilter key_frame_ratio_; |
77 float _keyFrameSpreadFrames; | 69 rtc::ExpFilter delta_frame_size_avg_kbits_; |
78 int32_t _keyFrameCount; | 70 |
79 float _accumulator; | 71 // Key frames and large delta frames are not immediately accumulated in the |
80 float _accumulatorMax; | 72 // bucket since they can immediately overflow the bucket leading to large |
81 float _targetBitRate; | 73 // drops on the following packets that may be much smaller. Instead these |
82 bool _dropNext; | 74 // large frames are accumulated over several frames when the bucket leaks. |
83 rtc::ExpFilter _dropRatio; | 75 |
84 int32_t _dropCount; | 76 // |large_frame_accumulation_spread_| represents the number of frames over |
85 float _windowSize; | 77 // which a large frame is accumulated. |
86 float _incoming_frame_rate; | 78 float large_frame_accumulation_spread_; |
87 bool _wasBelowMax; | 79 // |large_frame_accumulation_count_| represents the number of frames left |
88 bool _enabled; | 80 // to finish accumulating a large frame. |
89 bool _fastMode; | 81 int32_t large_frame_accumulation_count_; |
90 float _cap_buffer_size; | 82 // |large_frame_accumulation_chunk_size_| represents the size of a single |
91 float _max_time_drops; | 83 // chunk for large frame accumulation. |
92 }; // end of VCMFrameDropper class | 84 float large_frame_accumulation_chunk_size_; |
| 85 |
| 86 float accumulator_; |
| 87 float accumulator_max_; |
| 88 float target_bitrate_; |
| 89 bool drop_next_; |
| 90 rtc::ExpFilter drop_ratio_; |
| 91 int32_t drop_count_; |
| 92 float incoming_frame_rate_; |
| 93 bool was_below_max_; |
| 94 bool enabled_; |
| 95 const float max_drop_duration_secs_; |
| 96 }; |
93 | 97 |
94 } // namespace webrtc | 98 } // namespace webrtc |
95 | 99 |
96 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_FRAME_DROPPER_H_ | 100 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_FRAME_DROPPER_H_ |
OLD | NEW |