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 virtual void GetCurrentReceiveCodec(VideoCodec* receive_codec) OVERRIDE; 57 58 // Overrides I420FrameCallback. 59 virtual void FrameCallback(I420VideoFrame* video_frame) OVERRIDE; 60 61 // Overrides VideoRenderCallback. 62 virtual int32_t RenderFrame(const uint32_t stream_id, 63 I420VideoFrame& video_frame) OVERRIDE; 64 65 void SignalNetworkState(Call::NetworkState state); 66 67 virtual bool DeliverRtcp(const uint8_t* packet, size_t length); 68 virtual bool DeliverRtp(const uint8_t* packet, size_t length); 69 70 private: 71 void SetRtcpMode(newapi::RtcpMode mode); 72 73 TransportAdapter transport_adapter_; 74 EncodedFrameCallbackAdapter encoded_frame_proxy_; 75 const VideoReceiveStream::Config config_; 76 Clock* const clock_; 77 78 ViEBase* video_engine_base_; 79 ViECodec* codec_; 80 ViEExternalCodec* external_codec_; 81 ViENetwork* network_; 82 ViERender* render_; 83 ViERTP_RTCP* rtp_rtcp_; 84 ViEImageProcess* image_process_; 85 86 scoped_ptr<ReceiveStatisticsProxy> stats_proxy_; 87 88 int channel_; 89 }; 90 } // namespace internal 91 } // namespace webrtc 92 93 #endif // WEBRTC_VIDEO_VIDEO_RECEIVE_STREAM_H_ 94