blob: 8e9e0ffb6e3376055928a767e3661708ba29bbc9 [file] [log] [blame]
Florent Castellie7862cc2018-12-06 13:38:24 +01001/*
2 * Copyright (c) 2017 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
12#ifndef MEDIA_ENGINE_ENCODER_SIMULCAST_PROXY_H_
13#define MEDIA_ENGINE_ENCODER_SIMULCAST_PROXY_H_
14
15#include <stddef.h>
16#include <stdint.h>
Jonas Olssona4d87372019-07-05 19:08:33 +020017
Florent Castellie7862cc2018-12-06 13:38:24 +010018#include <memory>
19#include <vector>
20
21#include "api/video/video_bitrate_allocation.h"
22#include "api/video/video_frame.h"
23#include "api/video_codecs/sdp_video_format.h"
24#include "api/video_codecs/video_codec.h"
25#include "api/video_codecs/video_encoder.h"
26#include "api/video_codecs/video_encoder_factory.h"
Florent Castellie7862cc2018-12-06 13:38:24 +010027#include "modules/video_coding/include/video_codec_interface.h"
Mirko Bonadei66e76792019-04-02 11:33:59 +020028#include "rtc_base/system/rtc_export.h"
Florent Castellie7862cc2018-12-06 13:38:24 +010029
30namespace webrtc {
31
32// This class provides fallback to SimulcastEncoderAdapter if default VP8Encoder
33// doesn't support simulcast for provided settings.
Mirko Bonadei66e76792019-04-02 11:33:59 +020034class RTC_EXPORT EncoderSimulcastProxy : public VideoEncoder {
Florent Castellie7862cc2018-12-06 13:38:24 +010035 public:
36 EncoderSimulcastProxy(VideoEncoderFactory* factory,
37 const SdpVideoFormat& format);
38 // Deprecated. Remove once all clients use constructor with both factory and
39 // SdpVideoFormat;
40 explicit EncoderSimulcastProxy(VideoEncoderFactory* factory);
41
42 ~EncoderSimulcastProxy() override;
43
44 // Implements VideoEncoder.
45 int Release() override;
Elad Alon8f01c4e2019-06-28 15:19:43 +020046 void SetFecControllerOverride(
47 FecControllerOverride* fec_controller_override) override;
Elad Alon370f93a2019-06-11 14:57:57 +020048 int InitEncode(const VideoCodec* codec_settings,
49 const VideoEncoder::Settings& settings) override;
Florent Castellie7862cc2018-12-06 13:38:24 +010050 int Encode(const VideoFrame& input_image,
Niels Möller87e2d782019-03-07 10:18:23 +010051 const std::vector<VideoFrameType>* frame_types) override;
Florent Castellie7862cc2018-12-06 13:38:24 +010052 int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
Erik Språng16cb8f52019-04-12 13:59:09 +020053 void SetRates(const RateControlParameters& parameters) override;
Elad Alonfb20afd2019-04-10 16:38:16 +020054 void OnPacketLossRateUpdate(float packet_loss_rate) override;
55 void OnRttUpdate(int64_t rtt_ms) override;
56 void OnLossNotification(const LossNotification& loss_notification) override;
Florent Castellie7862cc2018-12-06 13:38:24 +010057 EncoderInfo GetEncoderInfo() const override;
58
59 private:
60 VideoEncoderFactory* const factory_;
61 SdpVideoFormat video_format_;
62 std::unique_ptr<VideoEncoder> encoder_;
63 EncodedImageCallback* callback_;
64};
65
66} // namespace webrtc
67
68#endif // MEDIA_ENGINE_ENCODER_SIMULCAST_PROXY_H_