tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

simulcast_to_svc_converter.h (2115B)


      1 /* Copyright (c) 2024 The WebRTC project authors. All Rights Reserved.
      2 *
      3 *  Use of this source code is governed by a BSD-style license
      4 *  that can be found in the LICENSE file in the root of the source
      5 *  tree. An additional intellectual property rights grant can be found
      6 *  in the file PATENTS.  All contributing project authors may
      7 *  be found in the AUTHORS file in the root of the source tree.
      8 */
      9 
     10 #ifndef MODULES_VIDEO_CODING_SVC_SIMULCAST_TO_SVC_CONVERTER_H_
     11 #define MODULES_VIDEO_CODING_SVC_SIMULCAST_TO_SVC_CONVERTER_H_
     12 
     13 #include <stddef.h>
     14 
     15 #include <memory>
     16 #include <vector>
     17 
     18 #include "api/video/encoded_image.h"
     19 #include "api/video_codecs/scalability_mode.h"
     20 #include "api/video_codecs/video_codec.h"
     21 #include "modules/video_coding/include/video_codec_interface.h"
     22 #include "modules/video_coding/svc/scalable_video_controller.h"
     23 #include "rtc_base/system/rtc_export.h"
     24 
     25 namespace webrtc {
     26 
     27 class RTC_EXPORT SimulcastToSvcConverter {
     28 public:
     29  explicit SimulcastToSvcConverter(const VideoCodec&);
     30  SimulcastToSvcConverter(SimulcastToSvcConverter&&) = default;
     31 
     32  SimulcastToSvcConverter(const SimulcastToSvcConverter&) = delete;
     33  SimulcastToSvcConverter& operator=(const SimulcastToSvcConverter&) = delete;
     34  SimulcastToSvcConverter& operator=(SimulcastToSvcConverter&&) = default;
     35 
     36  ~SimulcastToSvcConverter() = default;
     37 
     38  static bool IsConfigSupported(const VideoCodec& codec);
     39 
     40  VideoCodec GetConfig() const;
     41 
     42  void EncodeStarted(bool force_keyframe);
     43 
     44  bool ConvertFrame(EncodedImage& encoded_image,
     45                    CodecSpecificInfo& codec_specific);
     46 
     47 private:
     48  struct LayerState {
     49    LayerState(ScalabilityMode scalability_mode, int num_temporal_layers);
     50    ~LayerState() = default;
     51    LayerState(const LayerState&) = delete;
     52    LayerState(LayerState&&) = default;
     53 
     54    std::unique_ptr<ScalableVideoController> video_controller;
     55    ScalableVideoController::LayerFrameConfig layer_config;
     56    bool awaiting_frame;
     57  };
     58 
     59  VideoCodec config_;
     60 
     61  std::vector<LayerState> layers_;
     62 };
     63 
     64 }  // namespace webrtc
     65 
     66 #endif  // MODULES_VIDEO_CODING_SVC_SIMULCAST_TO_SVC_CONVERTER_H_