Erik Språng | 8abd56c | 2018-10-01 18:47:03 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 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 | |
Erik Språng | 4529fbc | 2018-10-12 10:30:31 +0200 | [diff] [blame] | 11 | #ifndef API_VIDEO_CODECS_VP8_TEMPORAL_LAYERS_H_ |
| 12 | #define API_VIDEO_CODECS_VP8_TEMPORAL_LAYERS_H_ |
Erik Språng | 8abd56c | 2018-10-01 18:47:03 +0200 | [diff] [blame] | 13 | |
Erik Språng | 8abd56c | 2018-10-01 18:47:03 +0200 | [diff] [blame] | 14 | #include <vector> |
| 15 | |
Elad Alon | de3360e | 2019-03-06 21:14:54 +0100 | [diff] [blame^] | 16 | #include "api/video_codecs/vp8_frame_buffer_controller.h" |
Elad Alon | 411b49b | 2019-01-29 14:05:55 +0100 | [diff] [blame] | 17 | #include "api/video_codecs/vp8_frame_config.h" |
Elad Alon | f5b216a | 2019-01-28 14:25:17 +0100 | [diff] [blame] | 18 | |
Erik Språng | 8abd56c | 2018-10-01 18:47:03 +0200 | [diff] [blame] | 19 | namespace webrtc { |
| 20 | |
Erik Språng | 4529fbc | 2018-10-12 10:30:31 +0200 | [diff] [blame] | 21 | // Two different flavors of temporal layers are currently available: |
| 22 | // kFixedPattern uses a fixed repeating pattern of 1-4 layers. |
| 23 | // kBitrateDynamic can allocate frames dynamically to 1 or 2 layers, based on |
| 24 | // the bitrate produced. |
| 25 | enum class Vp8TemporalLayersType { kFixedPattern, kBitrateDynamic }; |
Erik Språng | 8abd56c | 2018-10-01 18:47:03 +0200 | [diff] [blame] | 26 | |
Erik Språng | 8abd56c | 2018-10-01 18:47:03 +0200 | [diff] [blame] | 27 | // This interface defines a way of getting the encoder settings needed to |
Erik Språng | 4529fbc | 2018-10-12 10:30:31 +0200 | [diff] [blame] | 28 | // realize a temporal layer structure. |
Elad Alon | de3360e | 2019-03-06 21:14:54 +0100 | [diff] [blame^] | 29 | class Vp8TemporalLayers : public Vp8FrameBufferController { |
Erik Språng | 8abd56c | 2018-10-01 18:47:03 +0200 | [diff] [blame] | 30 | public: |
Elad Alon | de3360e | 2019-03-06 21:14:54 +0100 | [diff] [blame^] | 31 | ~Vp8TemporalLayers() override = default; |
Erik Språng | 8abd56c | 2018-10-01 18:47:03 +0200 | [diff] [blame] | 32 | |
Elad Alon | de3360e | 2019-03-06 21:14:54 +0100 | [diff] [blame^] | 33 | bool SupportsEncoderFrameDropping() const override = 0; |
Erik Språng | 8abd56c | 2018-10-01 18:47:03 +0200 | [diff] [blame] | 34 | |
Elad Alon | de3360e | 2019-03-06 21:14:54 +0100 | [diff] [blame^] | 35 | void OnRatesUpdated(const std::vector<uint32_t>& bitrates_bps, |
| 36 | int framerate_fps) override = 0; |
Erik Språng | 8abd56c | 2018-10-01 18:47:03 +0200 | [diff] [blame] | 37 | |
Elad Alon | de3360e | 2019-03-06 21:14:54 +0100 | [diff] [blame^] | 38 | bool UpdateConfiguration(Vp8EncoderConfig* cfg) override = 0; |
Erik Språng | 8abd56c | 2018-10-01 18:47:03 +0200 | [diff] [blame] | 39 | |
Elad Alon | de3360e | 2019-03-06 21:14:54 +0100 | [diff] [blame^] | 40 | Vp8FrameConfig UpdateLayerConfig(uint32_t rtp_timestamp) override = 0; |
Erik Språng | 8abd56c | 2018-10-01 18:47:03 +0200 | [diff] [blame] | 41 | |
Elad Alon | de3360e | 2019-03-06 21:14:54 +0100 | [diff] [blame^] | 42 | void OnEncodeDone(uint32_t rtp_timestamp, |
| 43 | size_t size_bytes, |
| 44 | bool is_keyframe, |
| 45 | int qp, |
| 46 | CodecSpecificInfo* info) override = 0; |
Erik Språng | 8abd56c | 2018-10-01 18:47:03 +0200 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | } // namespace webrtc |
| 50 | |
Erik Språng | 4529fbc | 2018-10-12 10:30:31 +0200 | [diff] [blame] | 51 | #endif // API_VIDEO_CODECS_VP8_TEMPORAL_LAYERS_H_ |