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_ratio_; |
76 rtc::ExpFilter _keyFrameRatio; | 68 rtc::ExpFilter delta_frame_size_avg_kbits_; |
77 float _keyFrameSpreadFrames; | 69 |
78 int32_t _keyFrameCount; | 70 // Key frames and large delta frames are not immediately accumulated in the |
79 float _accumulator; | 71 // bucket since they can immediately overflow the bucket leading to large |
80 float _accumulatorMax; | 72 // drops on the following packets that may be much smaller. Instead these |
81 float _targetBitRate; | 73 // large frames are accumulated over several frames when the bucket leaks. |
82 bool _dropNext; | 74 |
83 rtc::ExpFilter _dropRatio; | 75 // |large_frame_accumulation_spread_| represents the number of frames over |
84 int32_t _dropCount; | 76 // which a large frame is accumulated. |
85 float _windowSize; | 77 float large_frame_accumulation_spread_; |
86 float _incoming_frame_rate; | 78 // |large_frame_accumulation_count_| represents the number of frames left |
87 bool _wasBelowMax; | 79 // to finish accumulating a large frame. |
88 bool _enabled; | 80 int32_t large_frame_accumulation_count_; |
stefan-webrtc
2016/03/04 08:41:37
Use a regular int here and at line 90.
Irfan
2016/03/04 15:05:26
Done.
| |
89 bool _fastMode; | 81 // |large_frame_accumulation_chunk_size_| represents the size of a single |
90 float _cap_buffer_size; | 82 // chunk for large frame accumulation. |
91 float _max_time_drops; | 83 float large_frame_accumulation_chunk_size_; |
92 }; // end of VCMFrameDropper class | 84 |
85 float accumulator_; | |
86 float accumulator_max_; | |
87 float target_bitrate_; | |
88 bool drop_next_; | |
89 rtc::ExpFilter drop_ratio_; | |
90 int32_t drop_count_; | |
91 float incoming_frame_rate_; | |
92 bool was_below_max_; | |
93 bool enabled_; | |
94 const float max_drop_duration_secs_; | |
95 }; | |
93 | 96 |
94 } // namespace webrtc | 97 } // namespace webrtc |
95 | 98 |
96 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_FRAME_DROPPER_H_ | 99 #endif // WEBRTC_MODULES_VIDEO_CODING_UTILITY_FRAME_DROPPER_H_ |
OLD | NEW |