| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 |
| 11 | package org.webrtc; |
| 12 |
| 13 | /** |
| 14 | * BitrateAdjuster that adjusts the bitrate to compensate for changes in the framerate. Used with |
| 15 | * hardware codecs that assume the framerate never changes. |
| 16 | */ |
| 17 | class FramerateBitrateAdjuster extends BaseBitrateAdjuster { |
| 18 | private static final int INITIAL_FPS = 30; |
| 19 |
| 20 | @Override |
| 21 | public void setTargets(int targetBitrateBps, int targetFps) { |
| 22 | if (this.targetFps == 0) { |
| 23 | // Framerate-based bitrate adjustment always initializes to the same framerate. |
| 24 | targetFps = INITIAL_FPS; |
| 25 | } |
| 26 | super.setTargets(targetBitrateBps, targetFps); |
| 27 |
| 28 | this.targetBitrateBps = this.targetBitrateBps * INITIAL_FPS / this.targetFps; |
| 29 | } |
| 30 |
| 31 | @Override |
| 32 | public int getCodecConfigFramerate() { |
| 33 | return INITIAL_FPS; |
| 34 | } |
| 35 | } |
| 36 |