1 /* 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 18 #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" 27 #include "modules/video_coding/include/video_codec_interface.h" 28 #include "rtc_base/system/rtc_export.h" 29 30 namespace webrtc { 31 32 // This class provides fallback to SimulcastEncoderAdapter if default VP8Encoder 33 // doesn't support simulcast for provided settings. 34 class RTC_EXPORT EncoderSimulcastProxy : public VideoEncoder { 35 public: 36 EncoderSimulcastProxy(VideoEncoderFactory* factory, 37 const SdpVideoFormat& format); 38 ~EncoderSimulcastProxy() override; 39 40 // Implements VideoEncoder. 41 int Release() override; 42 void SetFecControllerOverride( 43 FecControllerOverride* fec_controller_override) override; 44 int InitEncode(const VideoCodec* codec_settings, 45 const VideoEncoder::Settings& settings) override; 46 int Encode(const VideoFrame& input_image, 47 const std::vector<VideoFrameType>* frame_types) override; 48 int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override; 49 void SetRates(const RateControlParameters& parameters) override; 50 void OnPacketLossRateUpdate(float packet_loss_rate) override; 51 void OnRttUpdate(int64_t rtt_ms) override; 52 void OnLossNotification(const LossNotification& loss_notification) override; 53 EncoderInfo GetEncoderInfo() const override; 54 55 private: 56 VideoEncoderFactory* const factory_; 57 SdpVideoFormat video_format_; 58 std::unique_ptr<VideoEncoder> encoder_; 59 EncodedImageCallback* callback_; 60 }; 61 62 } // namespace webrtc 63 64 #endif // MEDIA_ENGINE_ENCODER_SIMULCAST_PROXY_H_ 65