Jiawei Ou | 4206a0a | 2018-07-20 15:49:43 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 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 | #ifndef API_VIDEO_VIDEO_BITRATE_ALLOCATOR_H_ |
| 12 | #define API_VIDEO_VIDEO_BITRATE_ALLOCATOR_H_ |
| 13 | |
Florent Castelli | 8bbdb5b | 2019-08-02 15:16:28 +0200 | [diff] [blame^] | 14 | #include "api/units/data_rate.h" |
Jiawei Ou | 4206a0a | 2018-07-20 15:49:43 -0700 | [diff] [blame] | 15 | #include "api/video/video_bitrate_allocation.h" |
| 16 | |
| 17 | namespace webrtc { |
| 18 | |
Florent Castelli | 8bbdb5b | 2019-08-02 15:16:28 +0200 | [diff] [blame^] | 19 | struct VideoBitrateAllocationParameters { |
| 20 | VideoBitrateAllocationParameters(uint32_t total_bitrate_bps, |
| 21 | uint32_t framerate); |
| 22 | VideoBitrateAllocationParameters(DataRate total_bitrate, double framerate); |
| 23 | VideoBitrateAllocationParameters(DataRate total_bitrate, |
| 24 | DataRate stable_bitrate, |
| 25 | double framerate); |
| 26 | ~VideoBitrateAllocationParameters(); |
| 27 | |
| 28 | DataRate total_bitrate; |
| 29 | DataRate stable_bitrate; |
| 30 | double framerate; |
| 31 | }; |
| 32 | |
Jiawei Ou | 4206a0a | 2018-07-20 15:49:43 -0700 | [diff] [blame] | 33 | class VideoBitrateAllocator { |
| 34 | public: |
| 35 | VideoBitrateAllocator() {} |
| 36 | virtual ~VideoBitrateAllocator() {} |
| 37 | |
| 38 | virtual VideoBitrateAllocation GetAllocation(uint32_t total_bitrate_bps, |
Florent Castelli | 8bbdb5b | 2019-08-02 15:16:28 +0200 | [diff] [blame^] | 39 | uint32_t framerate); |
| 40 | |
| 41 | virtual VideoBitrateAllocation Allocate( |
| 42 | VideoBitrateAllocationParameters parameters); |
Jiawei Ou | 4206a0a | 2018-07-20 15:49:43 -0700 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | class VideoBitrateAllocationObserver { |
| 46 | public: |
| 47 | VideoBitrateAllocationObserver() {} |
| 48 | virtual ~VideoBitrateAllocationObserver() {} |
| 49 | |
| 50 | virtual void OnBitrateAllocationUpdated( |
| 51 | const VideoBitrateAllocation& allocation) = 0; |
| 52 | }; |
| 53 | |
| 54 | } // namespace webrtc |
| 55 | |
| 56 | #endif // API_VIDEO_VIDEO_BITRATE_ALLOCATOR_H_ |