Home | History | Annotate | Download | only in video
      1 /*
      2  *  Copyright (c) 2013 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 WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_
     12 #define WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_
     13 
     14 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
     15 #include "webrtc/video/encoded_frame_callback_adapter.h"
     16 #include "webrtc/video/send_statistics_proxy.h"
     17 #include "webrtc/video/transport_adapter.h"
     18 #include "webrtc/video_receive_stream.h"
     19 #include "webrtc/video_send_stream.h"
     20 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
     21 
     22 namespace webrtc {
     23 
     24 class CpuOveruseObserver;
     25 class VideoEngine;
     26 class ViEBase;
     27 class ViECapture;
     28 class ViECodec;
     29 class ViEExternalCapture;
     30 class ViEExternalCodec;
     31 class ViEImageProcess;
     32 class ViENetwork;
     33 class ViERTP_RTCP;
     34 
     35 namespace internal {
     36 
     37 class VideoSendStream : public webrtc::VideoSendStream,
     38                         public VideoSendStreamInput,
     39                         public SendStatisticsProxy::StatsProvider {
     40  public:
     41   VideoSendStream(newapi::Transport* transport,
     42                   CpuOveruseObserver* overuse_observer,
     43                   webrtc::VideoEngine* video_engine,
     44                   const VideoSendStream::Config& config,
     45                   const std::vector<VideoStream> video_streams,
     46                   const void* encoder_settings,
     47                   int base_channel,
     48                   int start_bitrate);
     49 
     50   virtual ~VideoSendStream();
     51 
     52   virtual void Start() OVERRIDE;
     53   virtual void Stop() OVERRIDE;
     54 
     55   virtual bool ReconfigureVideoEncoder(const std::vector<VideoStream>& streams,
     56                                        const void* encoder_settings) OVERRIDE;
     57 
     58   virtual Stats GetStats() const OVERRIDE;
     59 
     60   bool DeliverRtcp(const uint8_t* packet, size_t length);
     61 
     62   // From VideoSendStreamInput.
     63   virtual void SwapFrame(I420VideoFrame* frame) OVERRIDE;
     64 
     65   // From webrtc::VideoSendStream.
     66   virtual VideoSendStreamInput* Input() OVERRIDE;
     67 
     68  protected:
     69   // From SendStatisticsProxy::StreamStatsProvider.
     70   virtual bool GetSendSideDelay(VideoSendStream::Stats* stats) OVERRIDE;
     71   virtual std::string GetCName() OVERRIDE;
     72 
     73  private:
     74   TransportAdapter transport_adapter_;
     75   EncodedFrameCallbackAdapter encoded_frame_proxy_;
     76   const VideoSendStream::Config config_;
     77   const int start_bitrate_bps_;
     78 
     79   ViEBase* video_engine_base_;
     80   ViECapture* capture_;
     81   ViECodec* codec_;
     82   ViEExternalCapture* external_capture_;
     83   ViEExternalCodec* external_codec_;
     84   ViENetwork* network_;
     85   ViERTP_RTCP* rtp_rtcp_;
     86   ViEImageProcess* image_process_;
     87 
     88   int channel_;
     89   int capture_id_;
     90 
     91   const scoped_ptr<SendStatisticsProxy> stats_proxy_;
     92 };
     93 }  // namespace internal
     94 }  // namespace webrtc
     95 
     96 #endif  // WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_
     97