blob: b0cf0c6a4a9806902fdfad2849caef0a1d07a2a5 [file] [log] [blame]
pbos@webrtc.org29d58392013-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.orgf3973e82013-12-13 09:40:45 +000011#ifndef WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_
12#define WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_
pbos@webrtc.org29d58392013-05-16 12:08:03 +000013
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +000014#include <map>
15
pbos@webrtc.org29d58392013-05-16 12:08:03 +000016#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +000017#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
sprang@webrtc.org40709352013-11-26 11:41:59 +000018#include "webrtc/video/encoded_frame_callback_adapter.h"
sprang@webrtc.orgccd42842014-01-07 09:54:34 +000019#include "webrtc/video/send_statistics_proxy.h"
pbos@webrtc.org16e03b72013-10-28 16:32:01 +000020#include "webrtc/video/transport_adapter.h"
21#include "webrtc/video_receive_stream.h"
22#include "webrtc/video_send_stream.h"
pbos@webrtc.org64887612013-11-14 08:58:14 +000023#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
pbos@webrtc.org29d58392013-05-16 12:08:03 +000024
25namespace webrtc {
26
asapersson@webrtc.orgbdc5ed22014-01-31 10:05:07 +000027class CpuOveruseObserver;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000028class VideoEngine;
29class ViEBase;
30class ViECapture;
31class ViECodec;
32class ViEExternalCapture;
stefan@webrtc.org360e3762013-08-22 09:29:56 +000033class ViEExternalCodec;
pbos@webrtc.orgfe1ef932013-10-21 10:34:43 +000034class ViEImageProcess;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000035class ViENetwork;
36class ViERTP_RTCP;
37
38namespace internal {
mflodman@webrtc.org6879c8a2013-07-23 11:35:00 +000039
pbos@webrtc.org74fa4892013-08-23 09:19:30 +000040class VideoSendStream : public webrtc::VideoSendStream,
stefan@webrtc.org168f23f2014-07-11 13:44:02 +000041 public VideoSendStreamInput {
pbos@webrtc.org29d58392013-05-16 12:08:03 +000042 public:
43 VideoSendStream(newapi::Transport* transport,
asapersson@webrtc.orgbdc5ed22014-01-31 10:05:07 +000044 CpuOveruseObserver* overuse_observer,
pbos@webrtc.org29d58392013-05-16 12:08:03 +000045 webrtc::VideoEngine* video_engine,
mflodman@webrtc.orgf3973e82013-12-13 09:40:45 +000046 const VideoSendStream::Config& config,
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +000047 const std::vector<VideoStream> video_streams,
48 const void* encoder_settings,
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +000049 const std::map<uint32_t, RtpState>& suspended_ssrcs,
mflodman@webrtc.orgeb16b812014-06-16 08:57:39 +000050 int base_channel,
51 int start_bitrate);
pbos@webrtc.org29d58392013-05-16 12:08:03 +000052
53 virtual ~VideoSendStream();
54
pbos@webrtc.orga5c8d2c2014-04-24 11:13:21 +000055 virtual void Start() OVERRIDE;
56 virtual void Stop() OVERRIDE;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000057
pbos@webrtc.orgf577ae92014-03-19 08:43:57 +000058 virtual bool ReconfigureVideoEncoder(const std::vector<VideoStream>& streams,
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +000059 const void* encoder_settings) OVERRIDE;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000060
sprang@webrtc.orgccd42842014-01-07 09:54:34 +000061 virtual Stats GetStats() const OVERRIDE;
62
pbos@webrtc.orgbbb07e62013-08-05 12:01:36 +000063 bool DeliverRtcp(const uint8_t* packet, size_t length);
64
sprang@webrtc.orgccd42842014-01-07 09:54:34 +000065 // From VideoSendStreamInput.
sprang@webrtc.orgccd42842014-01-07 09:54:34 +000066 virtual void SwapFrame(I420VideoFrame* frame) OVERRIDE;
67
68 // From webrtc::VideoSendStream.
69 virtual VideoSendStreamInput* Input() OVERRIDE;
70
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +000071 typedef std::map<uint32_t, RtpState> RtpStateMap;
72 RtpStateMap GetRtpStates() const;
73
pbos@webrtc.org29d58392013-05-16 12:08:03 +000074 private:
pbos@webrtc.orgbe9d2a42014-06-30 13:19:09 +000075 void ConfigureSsrcs();
pbos@webrtc.orge75a1bf2013-09-18 11:52:42 +000076 TransportAdapter transport_adapter_;
sprang@webrtc.org40709352013-11-26 11:41:59 +000077 EncodedFrameCallbackAdapter encoded_frame_proxy_;
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +000078 const VideoSendStream::Config config_;
mflodman@webrtc.orgeb16b812014-06-16 08:57:39 +000079 const int start_bitrate_bps_;
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +000080 std::map<uint32_t, RtpState> suspended_ssrcs_;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000081
82 ViEBase* video_engine_base_;
83 ViECapture* capture_;
84 ViECodec* codec_;
85 ViEExternalCapture* external_capture_;
stefan@webrtc.org360e3762013-08-22 09:29:56 +000086 ViEExternalCodec* external_codec_;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000087 ViENetwork* network_;
88 ViERTP_RTCP* rtp_rtcp_;
pbos@webrtc.orgfe1ef932013-10-21 10:34:43 +000089 ViEImageProcess* image_process_;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000090
91 int channel_;
92 int capture_id_;
sprang@webrtc.orgccd42842014-01-07 09:54:34 +000093
stefan@webrtc.org168f23f2014-07-11 13:44:02 +000094 SendStatisticsProxy stats_proxy_;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000095};
96} // namespace internal
97} // namespace webrtc
98
mflodman@webrtc.orgf3973e82013-12-13 09:40:45 +000099#endif // WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_