blob: 14653de401d2ec841beb821b2763922c68f241e2 [file] [log] [blame]
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +00001/*
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
mflodman@webrtc.orgdadfc9e2013-12-13 09:40:45 +000011#ifndef WEBRTC_VIDEO_VIDEO_RECEIVE_STREAM_H_
12#define WEBRTC_VIDEO_VIDEO_RECEIVE_STREAM_H_
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000013
14#include <vector>
15
16#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
pbos@webrtc.org30519512013-11-20 13:19:54 +000017#include "webrtc/modules/video_render/include/video_render_defines.h"
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000018#include "webrtc/system_wrappers/interface/clock.h"
sprang@webrtc.orgc8ab7212014-02-07 12:06:29 +000019#include "webrtc/system_wrappers/interface/scoped_ptr.h"
sprang@webrtc.org2e98d452013-11-26 11:41:59 +000020#include "webrtc/video/encoded_frame_callback_adapter.h"
sprang@webrtc.orgc8ab7212014-02-07 12:06:29 +000021#include "webrtc/video/receive_statistics_proxy.h"
pbos@webrtc.org24e20892013-10-28 16:32:01 +000022#include "webrtc/video/transport_adapter.h"
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000023#include "webrtc/video_engine/include/vie_render.h"
pbos@webrtc.org24e20892013-10-28 16:32:01 +000024#include "webrtc/video_receive_stream.h"
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000025
26namespace webrtc {
27
28class VideoEngine;
29class ViEBase;
30class ViECodec;
pbos@webrtc.org618a0ec2013-09-09 08:26:30 +000031class ViEExternalCodec;
pbos@webrtc.org63301bd2013-10-21 10:34:43 +000032class ViEImageProcess;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000033class ViENetwork;
34class ViERender;
35class ViERTP_RTCP;
stefan@webrtc.orge0284102013-11-18 11:45:11 +000036class VoiceEngine;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000037
38namespace internal {
39
pbos@webrtc.orgc1797062013-08-23 09:19:30 +000040class VideoReceiveStream : public webrtc::VideoReceiveStream,
sprang@webrtc.orgc8ab7212014-02-07 12:06:29 +000041 public I420FrameCallback,
pbos@webrtc.org30519512013-11-20 13:19:54 +000042 public VideoRenderCallback {
sprang@webrtc.orgc8ab7212014-02-07 12:06:29 +000043
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000044 public:
45 VideoReceiveStream(webrtc::VideoEngine* video_engine,
pbos@webrtc.orgc1797062013-08-23 09:19:30 +000046 const VideoReceiveStream::Config& config,
stefan@webrtc.orge0284102013-11-18 11:45:11 +000047 newapi::Transport* transport,
mflodman@webrtc.orgdadfc9e2013-12-13 09:40:45 +000048 webrtc::VoiceEngine* voice_engine,
49 int base_channel);
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000050 virtual ~VideoReceiveStream();
51
pbos@webrtc.org7f9f8402013-11-20 11:36:47 +000052 virtual void StartReceiving() OVERRIDE;
53 virtual void StopReceiving() OVERRIDE;
sprang@webrtc.org0feb8fa2014-02-07 15:32:45 +000054 virtual Stats GetStats() const OVERRIDE;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000055
56 virtual void GetCurrentReceiveCodec(VideoCodec* receive_codec) OVERRIDE;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000057
sprang@webrtc.orgc8ab7212014-02-07 12:06:29 +000058 // Overrides I420FrameCallback.
59 virtual void FrameCallback(I420VideoFrame* video_frame) OVERRIDE;
60
61 // Overrides VideoRenderCallback.
pbos@webrtc.org30519512013-11-20 13:19:54 +000062 virtual int32_t RenderFrame(const uint32_t stream_id,
63 I420VideoFrame& video_frame) OVERRIDE;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000064
pbos@webrtc.orgce851092013-08-05 12:01:36 +000065 public:
66 virtual bool DeliverRtcp(const uint8_t* packet, size_t length);
67 virtual bool DeliverRtp(const uint8_t* packet, size_t length);
68
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000069 private:
pbos@webrtc.org1ddd57f2013-09-18 11:52:42 +000070 TransportAdapter transport_adapter_;
sprang@webrtc.org2e98d452013-11-26 11:41:59 +000071 EncodedFrameCallbackAdapter encoded_frame_proxy_;
pbos@webrtc.orgc1797062013-08-23 09:19:30 +000072 VideoReceiveStream::Config config_;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000073 Clock* clock_;
74
75 ViEBase* video_engine_base_;
76 ViECodec* codec_;
pbos@webrtc.org618a0ec2013-09-09 08:26:30 +000077 ViEExternalCodec* external_codec_;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000078 ViENetwork* network_;
79 ViERender* render_;
80 ViERTP_RTCP* rtp_rtcp_;
pbos@webrtc.org63301bd2013-10-21 10:34:43 +000081 ViEImageProcess* image_process_;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000082
sprang@webrtc.orgc8ab7212014-02-07 12:06:29 +000083 scoped_ptr<ReceiveStatisticsProxy> stats_proxy_;
84
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000085 int channel_;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000086};
mflodman@webrtc.orgdadfc9e2013-12-13 09:40:45 +000087} // namespace internal
88} // namespace webrtc
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000089
mflodman@webrtc.orgdadfc9e2013-12-13 09:40:45 +000090#endif // WEBRTC_VIDEO_VIDEO_RECEIVE_STREAM_H_