video_send_stream.h revision 2bb1bdab8d11f5445693c028335fb3ace631f636
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_SEND_STREAM_H_ 12#define WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_ 13 14#include <map> 15 16#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" 17#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" 18#include "webrtc/video/encoded_frame_callback_adapter.h" 19#include "webrtc/video/send_statistics_proxy.h" 20#include "webrtc/video/transport_adapter.h" 21#include "webrtc/video_receive_stream.h" 22#include "webrtc/video_send_stream.h" 23#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" 24 25namespace webrtc { 26 27class CpuOveruseObserver; 28class VideoEngine; 29class ViEBase; 30class ViECapture; 31class ViECodec; 32class ViEExternalCapture; 33class ViEExternalCodec; 34class ViEImageProcess; 35class ViENetwork; 36class ViERTP_RTCP; 37 38namespace internal { 39 40class VideoSendStream : public webrtc::VideoSendStream, 41 public VideoSendStreamInput, 42 public SendStatisticsProxy::StatsProvider { 43 public: 44 VideoSendStream(newapi::Transport* transport, 45 CpuOveruseObserver* overuse_observer, 46 webrtc::VideoEngine* video_engine, 47 const VideoSendStream::Config& config, 48 const std::vector<VideoStream> video_streams, 49 const void* encoder_settings, 50 const std::map<uint32_t, RtpState>& suspended_ssrcs, 51 int base_channel, 52 int start_bitrate); 53 54 virtual ~VideoSendStream(); 55 56 virtual void Start() OVERRIDE; 57 virtual void Stop() OVERRIDE; 58 59 virtual bool ReconfigureVideoEncoder(const std::vector<VideoStream>& streams, 60 const void* encoder_settings) OVERRIDE; 61 62 virtual Stats GetStats() const OVERRIDE; 63 64 bool DeliverRtcp(const uint8_t* packet, size_t length); 65 66 // From VideoSendStreamInput. 67 virtual void SwapFrame(I420VideoFrame* frame) OVERRIDE; 68 69 // From webrtc::VideoSendStream. 70 virtual VideoSendStreamInput* Input() OVERRIDE; 71 72 typedef std::map<uint32_t, RtpState> RtpStateMap; 73 RtpStateMap GetRtpStates() const; 74 75 protected: 76 // From SendStatisticsProxy::StreamStatsProvider. 77 virtual bool GetSendSideDelay(VideoSendStream::Stats* stats) OVERRIDE; 78 virtual std::string GetCName() OVERRIDE; 79 80 private: 81 void ConfigureSsrcs(); 82 TransportAdapter transport_adapter_; 83 EncodedFrameCallbackAdapter encoded_frame_proxy_; 84 const VideoSendStream::Config config_; 85 const int start_bitrate_bps_; 86 std::map<uint32_t, RtpState> suspended_ssrcs_; 87 88 ViEBase* video_engine_base_; 89 ViECapture* capture_; 90 ViECodec* codec_; 91 ViEExternalCapture* external_capture_; 92 ViEExternalCodec* external_codec_; 93 ViENetwork* network_; 94 ViERTP_RTCP* rtp_rtcp_; 95 ViEImageProcess* image_process_; 96 97 int channel_; 98 int capture_id_; 99 100 const scoped_ptr<SendStatisticsProxy> stats_proxy_; 101}; 102} // namespace internal 103} // namespace webrtc 104 105#endif // WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_ 106