blob: f1f8f7d1a3f416f582282ae1413e374dd4e43918 [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>
pbos@webrtc.orgdde16f12014-08-05 23:35:43 +000015#include <vector>
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +000016
pbos@webrtc.org29d58392013-05-16 12:08:03 +000017#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +000018#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
sprang@webrtc.org40709352013-11-26 11:41:59 +000019#include "webrtc/video/encoded_frame_callback_adapter.h"
sprang@webrtc.orgccd42842014-01-07 09:54:34 +000020#include "webrtc/video/send_statistics_proxy.h"
pbos@webrtc.org16e03b72013-10-28 16:32:01 +000021#include "webrtc/video/transport_adapter.h"
22#include "webrtc/video_receive_stream.h"
23#include "webrtc/video_send_stream.h"
pbos@webrtc.org64887612013-11-14 08:58:14 +000024#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
pbos@webrtc.org29d58392013-05-16 12:08:03 +000025
26namespace webrtc {
27
asapersson@webrtc.orgbdc5ed22014-01-31 10:05:07 +000028class CpuOveruseObserver;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000029class VideoEngine;
30class ViEBase;
31class ViECapture;
32class ViECodec;
33class ViEExternalCapture;
stefan@webrtc.org360e3762013-08-22 09:29:56 +000034class ViEExternalCodec;
pbos@webrtc.orgfe1ef932013-10-21 10:34:43 +000035class ViEImageProcess;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000036class ViENetwork;
37class ViERTP_RTCP;
38
39namespace internal {
mflodman@webrtc.org6879c8a2013-07-23 11:35:00 +000040
pbos@webrtc.org74fa4892013-08-23 09:19:30 +000041class VideoSendStream : public webrtc::VideoSendStream,
stefan@webrtc.org168f23f2014-07-11 13:44:02 +000042 public VideoSendStreamInput {
pbos@webrtc.org29d58392013-05-16 12:08:03 +000043 public:
44 VideoSendStream(newapi::Transport* transport,
asapersson@webrtc.orgbdc5ed22014-01-31 10:05:07 +000045 CpuOveruseObserver* overuse_observer,
pbos@webrtc.org29d58392013-05-16 12:08:03 +000046 webrtc::VideoEngine* video_engine,
mflodman@webrtc.orgf3973e82013-12-13 09:40:45 +000047 const VideoSendStream::Config& config,
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +000048 const std::vector<VideoStream> video_streams,
49 const void* encoder_settings,
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +000050 const std::map<uint32_t, RtpState>& suspended_ssrcs,
mflodman@webrtc.orgeb16b812014-06-16 08:57:39 +000051 int base_channel,
52 int start_bitrate);
pbos@webrtc.org29d58392013-05-16 12:08:03 +000053
54 virtual ~VideoSendStream();
55
pbos@webrtc.orga5c8d2c2014-04-24 11:13:21 +000056 virtual void Start() OVERRIDE;
57 virtual void Stop() OVERRIDE;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000058
pbos@webrtc.orgf577ae92014-03-19 08:43:57 +000059 virtual bool ReconfigureVideoEncoder(const std::vector<VideoStream>& streams,
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +000060 const void* encoder_settings) OVERRIDE;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000061
sprang@webrtc.orgccd42842014-01-07 09:54:34 +000062 virtual Stats GetStats() const OVERRIDE;
63
pbos@webrtc.orgbbb07e62013-08-05 12:01:36 +000064 bool DeliverRtcp(const uint8_t* packet, size_t length);
65
sprang@webrtc.orgccd42842014-01-07 09:54:34 +000066 // From VideoSendStreamInput.
sprang@webrtc.orgccd42842014-01-07 09:54:34 +000067 virtual void SwapFrame(I420VideoFrame* frame) OVERRIDE;
68
69 // From webrtc::VideoSendStream.
70 virtual VideoSendStreamInput* Input() OVERRIDE;
71
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +000072 typedef std::map<uint32_t, RtpState> RtpStateMap;
73 RtpStateMap GetRtpStates() const;
74
pbos@webrtc.org29d58392013-05-16 12:08:03 +000075 private:
pbos@webrtc.orgbe9d2a42014-06-30 13:19:09 +000076 void ConfigureSsrcs();
pbos@webrtc.orge75a1bf2013-09-18 11:52:42 +000077 TransportAdapter transport_adapter_;
sprang@webrtc.org40709352013-11-26 11:41:59 +000078 EncodedFrameCallbackAdapter encoded_frame_proxy_;
pbos@webrtc.org6ae48c62014-06-06 10:49:19 +000079 const VideoSendStream::Config config_;
mflodman@webrtc.orgeb16b812014-06-16 08:57:39 +000080 const int start_bitrate_bps_;
pbos@webrtc.org2bb1bda2014-07-07 13:06:48 +000081 std::map<uint32_t, RtpState> suspended_ssrcs_;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000082
83 ViEBase* video_engine_base_;
84 ViECapture* capture_;
85 ViECodec* codec_;
86 ViEExternalCapture* external_capture_;
stefan@webrtc.org360e3762013-08-22 09:29:56 +000087 ViEExternalCodec* external_codec_;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000088 ViENetwork* network_;
89 ViERTP_RTCP* rtp_rtcp_;
pbos@webrtc.orgfe1ef932013-10-21 10:34:43 +000090 ViEImageProcess* image_process_;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000091
92 int channel_;
93 int capture_id_;
sprang@webrtc.orgccd42842014-01-07 09:54:34 +000094
stefan@webrtc.org168f23f2014-07-11 13:44:02 +000095 SendStatisticsProxy stats_proxy_;
pbos@webrtc.org29d58392013-05-16 12:08:03 +000096};
97} // namespace internal
98} // namespace webrtc
99
mflodman@webrtc.orgf3973e82013-12-13 09:40:45 +0000100#endif // WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_