Upstream version 11.40.277.0
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / video / video_receive_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_RECEIVE_STREAM_H_
12 #define WEBRTC_VIDEO_VIDEO_RECEIVE_STREAM_H_
13
14 #include <vector>
15
16 #include "webrtc/call.h"
17 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
18 #include "webrtc/modules/video_render/include/video_render_defines.h"
19 #include "webrtc/system_wrappers/interface/clock.h"
20 #include "webrtc/system_wrappers/interface/scoped_ptr.h"
21 #include "webrtc/video/encoded_frame_callback_adapter.h"
22 #include "webrtc/video/receive_statistics_proxy.h"
23 #include "webrtc/video/transport_adapter.h"
24 #include "webrtc/video_engine/include/vie_render.h"
25 #include "webrtc/video_receive_stream.h"
26
27 namespace webrtc {
28
29 class VideoEngine;
30 class ViEBase;
31 class ViECodec;
32 class ViEExternalCodec;
33 class ViEImageProcess;
34 class ViENetwork;
35 class ViERender;
36 class ViERTP_RTCP;
37 class VoiceEngine;
38
39 namespace internal {
40
41 class VideoReceiveStream : public webrtc::VideoReceiveStream,
42                            public I420FrameCallback,
43                            public VideoRenderCallback {
44  public:
45   VideoReceiveStream(webrtc::VideoEngine* video_engine,
46                      const VideoReceiveStream::Config& config,
47                      newapi::Transport* transport,
48                      webrtc::VoiceEngine* voice_engine,
49                      int base_channel);
50   virtual ~VideoReceiveStream();
51
52   virtual void Start() OVERRIDE;
53   virtual void Stop() OVERRIDE;
54   virtual Stats GetStats() const OVERRIDE;
55
56   // Overrides I420FrameCallback.
57   virtual void FrameCallback(I420VideoFrame* video_frame) OVERRIDE;
58
59   // Overrides VideoRenderCallback.
60   virtual int32_t RenderFrame(const uint32_t stream_id,
61                               I420VideoFrame& video_frame) OVERRIDE;
62
63   void SignalNetworkState(Call::NetworkState state);
64
65   virtual bool DeliverRtcp(const uint8_t* packet, size_t length);
66   virtual bool DeliverRtp(const uint8_t* packet, size_t length);
67
68  private:
69   void SetRtcpMode(newapi::RtcpMode mode);
70
71   TransportAdapter transport_adapter_;
72   EncodedFrameCallbackAdapter encoded_frame_proxy_;
73   const VideoReceiveStream::Config config_;
74   Clock* const clock_;
75
76   ViEBase* video_engine_base_;
77   ViECodec* codec_;
78   ViEExternalCodec* external_codec_;
79   ViENetwork* network_;
80   ViERender* render_;
81   ViERTP_RTCP* rtp_rtcp_;
82   ViEImageProcess* image_process_;
83
84   scoped_ptr<ReceiveStatisticsProxy> stats_proxy_;
85
86   int channel_;
87 };
88 }  // namespace internal
89 }  // namespace webrtc
90
91 #endif  // WEBRTC_VIDEO_VIDEO_RECEIVE_STREAM_H_