video_send_stream.h revision de1429e9ad9a3a207ca191e1d748aa7271066860
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
22namespace webrtc {
23
24class CpuOveruseObserver;
25class VideoEngine;
26class ViEBase;
27class ViECapture;
28class ViECodec;
29class ViEExternalCapture;
30class ViEExternalCodec;
31class ViEImageProcess;
32class ViENetwork;
33class ViERTP_RTCP;
34
35namespace internal {
36
37class 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                  int base_channel);
46
47  virtual ~VideoSendStream();
48
49  virtual void Start() OVERRIDE;
50  virtual void Stop() OVERRIDE;
51
52  virtual bool ReconfigureVideoEncoder(const std::vector<VideoStream>& streams,
53                                       void* encoder_settings) OVERRIDE;
54
55  virtual Stats GetStats() const OVERRIDE;
56
57  bool DeliverRtcp(const uint8_t* packet, size_t length);
58
59  // From VideoSendStreamInput.
60  virtual void PutFrame(const I420VideoFrame& frame) OVERRIDE;
61  virtual void SwapFrame(I420VideoFrame* frame) OVERRIDE;
62
63  // From webrtc::VideoSendStream.
64  virtual VideoSendStreamInput* Input() OVERRIDE;
65
66 protected:
67  // From SendStatisticsProxy::StreamStatsProvider.
68  virtual bool GetSendSideDelay(VideoSendStream::Stats* stats) OVERRIDE;
69  virtual std::string GetCName() OVERRIDE;
70
71 private:
72  I420VideoFrame input_frame_;
73  TransportAdapter transport_adapter_;
74  EncodedFrameCallbackAdapter encoded_frame_proxy_;
75  scoped_ptr<CriticalSectionWrapper> codec_lock_;
76  VideoSendStream::Config config_;
77
78  ViEBase* video_engine_base_;
79  ViECapture* capture_;
80  ViECodec* codec_;
81  ViEExternalCapture* external_capture_;
82  ViEExternalCodec* external_codec_;
83  ViENetwork* network_;
84  ViERTP_RTCP* rtp_rtcp_;
85  ViEImageProcess* image_process_;
86
87  int channel_;
88  int capture_id_;
89
90  const scoped_ptr<SendStatisticsProxy> stats_proxy_;
91};
92}  // namespace internal
93}  // namespace webrtc
94
95#endif  // WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_
96