LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/video_coding/codecs/vp8 - simulcast_encoder_adapter.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 3 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  *  Copyright (c) 2014 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 WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_ENCODER_ADAPTER_H_
      13             : #define WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_ENCODER_ADAPTER_H_
      14             : 
      15             : #include <memory>
      16             : #include <string>
      17             : #include <vector>
      18             : 
      19             : #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h"
      20             : 
      21             : namespace webrtc {
      22             : 
      23             : class SimulcastRateAllocator;
      24             : 
      25             : class VideoEncoderFactory {
      26             :  public:
      27             :   virtual VideoEncoder* Create() = 0;
      28             :   virtual void Destroy(VideoEncoder* encoder) = 0;
      29             :   virtual ~VideoEncoderFactory() {}
      30             : };
      31             : 
      32             : // SimulcastEncoderAdapter implements simulcast support by creating multiple
      33             : // webrtc::VideoEncoder instances with the given VideoEncoderFactory.
      34             : // All the public interfaces are expected to be called from the same thread,
      35             : // e.g the encoder thread.
      36             : class SimulcastEncoderAdapter : public VP8Encoder {
      37             :  public:
      38             :   explicit SimulcastEncoderAdapter(VideoEncoderFactory* factory);
      39             :   virtual ~SimulcastEncoderAdapter();
      40             : 
      41             :   // Implements VideoEncoder
      42             :   int Release() override;
      43             :   int InitEncode(const VideoCodec* inst,
      44             :                  int number_of_cores,
      45             :                  size_t max_payload_size) override;
      46             :   int Encode(const VideoFrame& input_image,
      47             :              const CodecSpecificInfo* codec_specific_info,
      48             :              const std::vector<FrameType>* frame_types) override;
      49             :   int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override;
      50             :   int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override;
      51             :   int SetRateAllocation(const BitrateAllocation& bitrate,
      52             :                         uint32_t new_framerate) override;
      53             : 
      54             :   // Eventual handler for the contained encoders' EncodedImageCallbacks, but
      55             :   // called from an internal helper that also knows the correct stream
      56             :   // index.
      57             :   EncodedImageCallback::Result OnEncodedImage(
      58             :       size_t stream_idx,
      59             :       const EncodedImage& encoded_image,
      60             :       const CodecSpecificInfo* codec_specific_info,
      61             :       const RTPFragmentationHeader* fragmentation);
      62             : 
      63             :   VideoEncoder::ScalingSettings GetScalingSettings() const override;
      64             : 
      65             :   bool SupportsNativeHandle() const override;
      66             :   const char* ImplementationName() const override;
      67             : 
      68             :  private:
      69             :   struct StreamInfo {
      70             :     StreamInfo()
      71             :         : encoder(NULL),
      72             :           callback(NULL),
      73             :           width(0),
      74             :           height(0),
      75             :           key_frame_request(false),
      76             :           send_stream(true) {}
      77           0 :     StreamInfo(VideoEncoder* encoder,
      78             :                EncodedImageCallback* callback,
      79             :                uint16_t width,
      80             :                uint16_t height,
      81             :                bool send_stream)
      82           0 :         : encoder(encoder),
      83             :           callback(callback),
      84             :           width(width),
      85             :           height(height),
      86             :           key_frame_request(false),
      87           0 :           send_stream(send_stream) {}
      88             :     // Deleted by SimulcastEncoderAdapter::Release().
      89             :     VideoEncoder* encoder;
      90             :     EncodedImageCallback* callback;
      91             :     uint16_t width;
      92             :     uint16_t height;
      93             :     bool key_frame_request;
      94             :     bool send_stream;
      95             :   };
      96             : 
      97             :   // Populate the codec settings for each stream.
      98             :   void PopulateStreamCodec(const webrtc::VideoCodec* inst,
      99             :                            int stream_index,
     100             :                            uint32_t start_bitrate_kbps,
     101             :                            bool highest_resolution_stream,
     102             :                            webrtc::VideoCodec* stream_codec);
     103             : 
     104             :   bool Initialized() const;
     105             : 
     106             :   std::unique_ptr<VideoEncoderFactory> factory_;
     107             :   VideoCodec codec_;
     108             :   std::vector<StreamInfo> streaminfos_;
     109             :   EncodedImageCallback* encoded_complete_callback_;
     110             :   std::string implementation_name_;
     111             : };
     112             : 
     113             : }  // namespace webrtc
     114             : 
     115             : #endif  // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_ENCODER_ADAPTER_H_

Generated by: LCOV version 1.13