Upstream version 6.35.121.0
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / video / video_send_stream.h
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                   int base_channel);
46
47   virtual ~VideoSendStream();
48
49   virtual void StartSending() OVERRIDE;
50
51   virtual void StopSending() OVERRIDE;
52
53   virtual bool ReconfigureVideoEncoder(const std::vector<VideoStream>& streams,
54                                        void* encoder_settings) OVERRIDE;
55
56   virtual Stats GetStats() const OVERRIDE;
57
58   bool DeliverRtcp(const uint8_t* packet, size_t length);
59
60   // From VideoSendStreamInput.
61   virtual void PutFrame(const I420VideoFrame& frame) OVERRIDE;
62   virtual void SwapFrame(I420VideoFrame* frame) OVERRIDE;
63
64   // From webrtc::VideoSendStream.
65   virtual VideoSendStreamInput* Input() OVERRIDE;
66
67  protected:
68   // From SendStatisticsProxy::StreamStatsProvider.
69   virtual bool GetSendSideDelay(VideoSendStream::Stats* stats) OVERRIDE;
70   virtual std::string GetCName() OVERRIDE;
71
72  private:
73   I420VideoFrame input_frame_;
74   TransportAdapter transport_adapter_;
75   EncodedFrameCallbackAdapter encoded_frame_proxy_;
76   scoped_ptr<CriticalSectionWrapper> codec_lock_;
77   VideoSendStream::Config config_;
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   scoped_ptr<SendStatisticsProxy> stats_proxy_;
92 };
93 }  // namespace internal
94 }  // namespace webrtc
95
96 #endif  // WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_