blob: 61a9defea51bfd12367f003787a2963c251e312e [file] [log] [blame]
Erik Språng8abd56c2018-10-01 18:47:03 +02001/*
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ång4529fbc2018-10-12 10:30:31 +020011#ifndef API_VIDEO_CODECS_VP8_TEMPORAL_LAYERS_H_
12#define API_VIDEO_CODECS_VP8_TEMPORAL_LAYERS_H_
Erik Språng8abd56c2018-10-01 18:47:03 +020013
Erik Språng8abd56c2018-10-01 18:47:03 +020014#include <vector>
15
Elad Alonde3360e2019-03-06 21:14:54 +010016#include "api/video_codecs/vp8_frame_buffer_controller.h"
Elad Alon411b49b2019-01-29 14:05:55 +010017#include "api/video_codecs/vp8_frame_config.h"
Elad Alonf5b216a2019-01-28 14:25:17 +010018
Erik Språng8abd56c2018-10-01 18:47:03 +020019namespace webrtc {
20
Erik Språng4529fbc2018-10-12 10:30:31 +020021// 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.
25enum class Vp8TemporalLayersType { kFixedPattern, kBitrateDynamic };
Erik Språng8abd56c2018-10-01 18:47:03 +020026
Erik Språng8abd56c2018-10-01 18:47:03 +020027// This interface defines a way of getting the encoder settings needed to
Erik Språng4529fbc2018-10-12 10:30:31 +020028// realize a temporal layer structure.
Elad Alonde3360e2019-03-06 21:14:54 +010029class Vp8TemporalLayers : public Vp8FrameBufferController {
Erik Språng8abd56c2018-10-01 18:47:03 +020030 public:
Elad Alonde3360e2019-03-06 21:14:54 +010031 ~Vp8TemporalLayers() override = default;
Erik Språng8abd56c2018-10-01 18:47:03 +020032
Elad Alonde3360e2019-03-06 21:14:54 +010033 bool SupportsEncoderFrameDropping() const override = 0;
Erik Språng8abd56c2018-10-01 18:47:03 +020034
Elad Alonde3360e2019-03-06 21:14:54 +010035 void OnRatesUpdated(const std::vector<uint32_t>& bitrates_bps,
36 int framerate_fps) override = 0;
Erik Språng8abd56c2018-10-01 18:47:03 +020037
Elad Alonde3360e2019-03-06 21:14:54 +010038 bool UpdateConfiguration(Vp8EncoderConfig* cfg) override = 0;
Erik Språng8abd56c2018-10-01 18:47:03 +020039
Elad Alonde3360e2019-03-06 21:14:54 +010040 Vp8FrameConfig UpdateLayerConfig(uint32_t rtp_timestamp) override = 0;
Erik Språng8abd56c2018-10-01 18:47:03 +020041
Elad Alonde3360e2019-03-06 21:14:54 +010042 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ång8abd56c2018-10-01 18:47:03 +020047};
48
49} // namespace webrtc
50
Erik Språng4529fbc2018-10-12 10:30:31 +020051#endif // API_VIDEO_CODECS_VP8_TEMPORAL_LAYERS_H_