blob: ed77665c1a9b6344f8fc05e31bc516c38efdddb7 [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_SEND_STREAM_H_
12#define WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000013
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000014#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
sprang@webrtc.org2e98d452013-11-26 11:41:59 +000015#include "webrtc/video/encoded_frame_callback_adapter.h"
sprang@webrtc.org49812e62014-01-07 09:54:34 +000016#include "webrtc/video/send_statistics_proxy.h"
pbos@webrtc.org24e20892013-10-28 16:32:01 +000017#include "webrtc/video/transport_adapter.h"
18#include "webrtc/video_receive_stream.h"
19#include "webrtc/video_send_stream.h"
pbos@webrtc.org69040542013-11-14 08:58:14 +000020#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000021
22namespace webrtc {
23
asapersson@webrtc.org8ef65482014-01-31 10:05:07 +000024class CpuOveruseObserver;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000025class VideoEngine;
26class ViEBase;
27class ViECapture;
28class ViECodec;
29class ViEExternalCapture;
stefan@webrtc.org55afdbe2013-08-22 09:29:56 +000030class ViEExternalCodec;
pbos@webrtc.org63301bd2013-10-21 10:34:43 +000031class ViEImageProcess;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000032class ViENetwork;
33class ViERTP_RTCP;
34
35namespace internal {
mflodman@webrtc.orgbf76ae22013-07-23 11:35:00 +000036
pbos@webrtc.orgc1797062013-08-23 09:19:30 +000037class VideoSendStream : public webrtc::VideoSendStream,
sprang@webrtc.org49812e62014-01-07 09:54:34 +000038 public VideoSendStreamInput,
sprang@webrtc.orgc8ab7212014-02-07 12:06:29 +000039 public SendStatisticsProxy::StatsProvider {
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000040 public:
41 VideoSendStream(newapi::Transport* transport,
asapersson@webrtc.org8ef65482014-01-31 10:05:07 +000042 CpuOveruseObserver* overuse_observer,
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000043 webrtc::VideoEngine* video_engine,
mflodman@webrtc.orgdadfc9e2013-12-13 09:40:45 +000044 const VideoSendStream::Config& config,
pbos@webrtc.orgbdfcddf2014-06-06 10:49:19 +000045 const std::vector<VideoStream> video_streams,
46 const void* encoder_settings,
mflodman@webrtc.orgf89ce462014-06-16 08:57:39 +000047 int base_channel,
48 int start_bitrate);
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000049
50 virtual ~VideoSendStream();
51
pbos@webrtc.org16a058a2014-04-24 11:13:21 +000052 virtual void Start() OVERRIDE;
53 virtual void Stop() OVERRIDE;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000054
pbos@webrtc.orge2a7a772014-03-19 08:43:57 +000055 virtual bool ReconfigureVideoEncoder(const std::vector<VideoStream>& streams,
pbos@webrtc.orgbdfcddf2014-06-06 10:49:19 +000056 const void* encoder_settings) OVERRIDE;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000057
sprang@webrtc.org49812e62014-01-07 09:54:34 +000058 virtual Stats GetStats() const OVERRIDE;
59
pbos@webrtc.orgce851092013-08-05 12:01:36 +000060 bool DeliverRtcp(const uint8_t* packet, size_t length);
61
sprang@webrtc.org49812e62014-01-07 09:54:34 +000062 // From VideoSendStreamInput.
sprang@webrtc.org49812e62014-01-07 09:54:34 +000063 virtual void SwapFrame(I420VideoFrame* frame) OVERRIDE;
64
65 // From webrtc::VideoSendStream.
66 virtual VideoSendStreamInput* Input() OVERRIDE;
67
68 protected:
69 // From SendStatisticsProxy::StreamStatsProvider.
70 virtual bool GetSendSideDelay(VideoSendStream::Stats* stats) OVERRIDE;
71 virtual std::string GetCName() OVERRIDE;
72
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000073 private:
pbos@webrtc.org1ddd57f2013-09-18 11:52:42 +000074 TransportAdapter transport_adapter_;
sprang@webrtc.org2e98d452013-11-26 11:41:59 +000075 EncodedFrameCallbackAdapter encoded_frame_proxy_;
pbos@webrtc.orgbdfcddf2014-06-06 10:49:19 +000076 const VideoSendStream::Config config_;
mflodman@webrtc.orgf89ce462014-06-16 08:57:39 +000077 const int start_bitrate_bps_;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000078
79 ViEBase* video_engine_base_;
80 ViECapture* capture_;
81 ViECodec* codec_;
82 ViEExternalCapture* external_capture_;
stefan@webrtc.org55afdbe2013-08-22 09:29:56 +000083 ViEExternalCodec* external_codec_;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000084 ViENetwork* network_;
85 ViERTP_RTCP* rtp_rtcp_;
pbos@webrtc.org63301bd2013-10-21 10:34:43 +000086 ViEImageProcess* image_process_;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000087
88 int channel_;
89 int capture_id_;
sprang@webrtc.org49812e62014-01-07 09:54:34 +000090
pbos@webrtc.orgc476e642014-04-28 13:00:21 +000091 const scoped_ptr<SendStatisticsProxy> stats_proxy_;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000092};
93} // namespace internal
94} // namespace webrtc
95
mflodman@webrtc.orgdadfc9e2013-12-13 09:40:45 +000096#endif // WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_