blob: 29151ad5e5448640ddebdc832a98f34694d0e1a7 [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>
17#include <memory>
18#include <vector>
19
20#include "api/video/video_bitrate_allocation.h"
21#include "api/video/video_frame.h"
22#include "api/video_codecs/sdp_video_format.h"
23#include "api/video_codecs/video_codec.h"
24#include "api/video_codecs/video_encoder.h"
25#include "api/video_codecs/video_encoder_factory.h"
Florent Castellie7862cc2018-12-06 13:38:24 +010026#include "modules/video_coding/include/video_codec_interface.h"
27
28namespace webrtc {
29
30// This class provides fallback to SimulcastEncoderAdapter if default VP8Encoder
31// doesn't support simulcast for provided settings.
32class EncoderSimulcastProxy : public VideoEncoder {
33 public:
34 EncoderSimulcastProxy(VideoEncoderFactory* factory,
35 const SdpVideoFormat& format);
36 // Deprecated. Remove once all clients use constructor with both factory and
37 // SdpVideoFormat;
38 explicit EncoderSimulcastProxy(VideoEncoderFactory* factory);
39
40 ~EncoderSimulcastProxy() override;
41
42 // Implements VideoEncoder.
43 int Release() override;
44 int InitEncode(const VideoCodec* inst,
45 int number_of_cores,
46 size_t max_payload_size) override;
47 int Encode(const VideoFrame& input_image,
Niels Möller87e2d782019-03-07 10:18:23 +010048 const std::vector<VideoFrameType>* frame_types) override;
Florent Castellie7862cc2018-12-06 13:38:24 +010049 int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
50 int SetRateAllocation(const VideoBitrateAllocation& bitrate,
51 uint32_t new_framerate) override;
52 EncoderInfo GetEncoderInfo() const override;
53
54 private:
55 VideoEncoderFactory* const factory_;
56 SdpVideoFormat video_format_;
57 std::unique_ptr<VideoEncoder> encoder_;
58 EncodedImageCallback* callback_;
59};
60
61} // namespace webrtc
62
63#endif // MEDIA_ENGINE_ENCODER_SIMULCAST_PROXY_H_