encoder_simulcast_proxy.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. #ifndef MEDIA_ENGINE_ENCODER_SIMULCAST_PROXY_H_
  12. #define MEDIA_ENGINE_ENCODER_SIMULCAST_PROXY_H_
  13. #include <stddef.h>
  14. #include <stdint.h>
  15. #include <memory>
  16. #include <vector>
  17. #include "api/video/video_bitrate_allocation.h"
  18. #include "api/video/video_frame.h"
  19. #include "api/video_codecs/sdp_video_format.h"
  20. #include "api/video_codecs/video_codec.h"
  21. #include "api/video_codecs/video_encoder.h"
  22. #include "api/video_codecs/video_encoder_factory.h"
  23. #include "modules/video_coding/include/video_codec_interface.h"
  24. #include "rtc_base/system/rtc_export.h"
  25. namespace webrtc {
  26. // This class provides fallback to SimulcastEncoderAdapter if default VP8Encoder
  27. // doesn't support simulcast for provided settings.
  28. class RTC_EXPORT EncoderSimulcastProxy : public VideoEncoder {
  29. public:
  30. EncoderSimulcastProxy(VideoEncoderFactory* factory,
  31. const SdpVideoFormat& format);
  32. // Deprecated. Remove once all clients use constructor with both factory and
  33. // SdpVideoFormat;
  34. explicit EncoderSimulcastProxy(VideoEncoderFactory* factory);
  35. ~EncoderSimulcastProxy() override;
  36. // Implements VideoEncoder.
  37. int Release() override;
  38. void SetFecControllerOverride(
  39. FecControllerOverride* fec_controller_override) override;
  40. int InitEncode(const VideoCodec* codec_settings,
  41. const VideoEncoder::Settings& settings) override;
  42. int Encode(const VideoFrame& input_image,
  43. const std::vector<VideoFrameType>* frame_types) override;
  44. int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
  45. void SetRates(const RateControlParameters& parameters) override;
  46. void OnPacketLossRateUpdate(float packet_loss_rate) override;
  47. void OnRttUpdate(int64_t rtt_ms) override;
  48. void OnLossNotification(const LossNotification& loss_notification) override;
  49. EncoderInfo GetEncoderInfo() const override;
  50. private:
  51. VideoEncoderFactory* const factory_;
  52. SdpVideoFormat video_format_;
  53. std::unique_ptr<VideoEncoder> encoder_;
  54. EncodedImageCallback* callback_;
  55. };
  56. } // namespace webrtc
  57. #endif // MEDIA_ENGINE_ENCODER_SIMULCAST_PROXY_H_