video_send_stream.h revision cd6702282a49448adda470934f4bd9e6181cab22
129d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org/* 229d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 329d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org * 429d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org * Use of this source code is governed by a BSD-style license 529d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org * that can be found in the LICENSE file in the root of the source 629d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org * tree. An additional intellectual property rights grant can be found 729d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org * in the file PATENTS. All contributing project authors may 829d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org * be found in the AUTHORS file in the root of the source tree. 929d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org */ 1029d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org 11f3973e81d5aa7e4f1d6b5abdfe3a6dc53a32840cmflodman@webrtc.org#ifndef WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_ 12f3973e81d5aa7e4f1d6b5abdfe3a6dc53a32840cmflodman@webrtc.org#define WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_ 1329d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org 142bb1bdab8d11f5445693c028335fb3ace631f636pbos@webrtc.org#include <map> 15dde16f19e3ed36ca462f6404c40d5a9811f0ec37pbos@webrtc.org#include <vector> 162bb1bdab8d11f5445693c028335fb3ace631f636pbos@webrtc.org 1726c0c41a06d77af54df547169d952a21319dea8cpbos@webrtc.org#include "webrtc/call.h" 1829d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" 192bb1bdab8d11f5445693c028335fb3ace631f636pbos@webrtc.org#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h" 204070935f4fb5b9fb2df246d7073fe0ba7e350791sprang@webrtc.org#include "webrtc/video/encoded_frame_callback_adapter.h" 21ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org#include "webrtc/video/send_statistics_proxy.h" 2216e03b7bd8b88ba569987e20a7f29061f91a3d0dpbos@webrtc.org#include "webrtc/video/transport_adapter.h" 234b91bd08979fcfb191cdae27ad24936beefce735Peter Boström#include "webrtc/video/video_capture_input.h" 2416e03b7bd8b88ba569987e20a7f29061f91a3d0dpbos@webrtc.org#include "webrtc/video_receive_stream.h" 2516e03b7bd8b88ba569987e20a7f29061f91a3d0dpbos@webrtc.org#include "webrtc/video_send_stream.h" 266488761f2e6ce7b977bbc14bc7b91933527d633apbos@webrtc.org#include "webrtc/system_wrappers/interface/critical_section_wrapper.h" 2729d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org 2829d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.orgnamespace webrtc { 2929d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org 30300eeb68f55c5091c7045e377578586733cddf16Peter Boströmclass ChannelGroup; 31bdc5ed2e7d081de6597f0f993d54489eb3abd496asapersson@webrtc.orgclass CpuOveruseObserver; 32f16fcbec734e1e3303828525c9fd7e13e0803aabPeter Boströmclass ProcessThread; 3359d91dc951143995069798edee05e757502f335cPeter Boströmclass ViEChannel; 3459d91dc951143995069798edee05e757502f335cPeter Boströmclass ViEEncoder; 3529d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org 3629d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.orgnamespace internal { 376879c8adad604d51db200de56f9afe08282973a6mflodman@webrtc.org 384b91bd08979fcfb191cdae27ad24936beefce735Peter Boströmclass VideoSendStream : public webrtc::VideoSendStream { 3929d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org public: 4029d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org VideoSendStream(newapi::Transport* transport, 41bdc5ed2e7d081de6597f0f993d54489eb3abd496asapersson@webrtc.org CpuOveruseObserver* overuse_observer, 4245553aefacb797818da83ccef1c3679a8aa0fc7fPeter Boström int num_cpu_cores, 43f16fcbec734e1e3303828525c9fd7e13e0803aabPeter Boström ProcessThread* module_process_thread, 4445553aefacb797818da83ccef1c3679a8aa0fc7fPeter Boström ChannelGroup* channel_group, 4545553aefacb797818da83ccef1c3679a8aa0fc7fPeter Boström int channel_id, 46f3973e81d5aa7e4f1d6b5abdfe3a6dc53a32840cmflodman@webrtc.org const VideoSendStream::Config& config, 47bbe0a8517d7f9da7aa779bff77cdbb70df358437pbos@webrtc.org const VideoEncoderConfig& encoder_config, 4845553aefacb797818da83ccef1c3679a8aa0fc7fPeter Boström const std::map<uint32_t, RtpState>& suspended_ssrcs); 4929d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org 50cd6702282a49448adda470934f4bd9e6181cab22Jelena Marusic ~VideoSendStream() override; 514b91bd08979fcfb191cdae27ad24936beefce735Peter Boström 52cd6702282a49448adda470934f4bd9e6181cab22Jelena Marusic // webrtc::SendStream implementation. 5314665ff7d4024d07e58622f498b23fd980001871kjellander@webrtc.org void Start() override; 5414665ff7d4024d07e58622f498b23fd980001871kjellander@webrtc.org void Stop() override; 55cd6702282a49448adda470934f4bd9e6181cab22Jelena Marusic void SignalNetworkState(NetworkState state) override; 56cd6702282a49448adda470934f4bd9e6181cab22Jelena Marusic bool DeliverRtcp(const uint8_t* packet, size_t length) override; 5729d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org 58cd6702282a49448adda470934f4bd9e6181cab22Jelena Marusic // webrtc::VideoSendStream implementation. 59cd6702282a49448adda470934f4bd9e6181cab22Jelena Marusic VideoCaptureInput* Input() override; 6014665ff7d4024d07e58622f498b23fd980001871kjellander@webrtc.org bool ReconfigureVideoEncoder(const VideoEncoderConfig& config) override; 6114665ff7d4024d07e58622f498b23fd980001871kjellander@webrtc.org Stats GetStats() override; 62ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org 632bb1bdab8d11f5445693c028335fb3ace631f636pbos@webrtc.org typedef std::map<uint32_t, RtpState> RtpStateMap; 642bb1bdab8d11f5445693c028335fb3ace631f636pbos@webrtc.org RtpStateMap GetRtpStates() const; 652bb1bdab8d11f5445693c028335fb3ace631f636pbos@webrtc.org 6616825b1a828bb4ff40f7682040e43a239b7b8ca3pkasting@chromium.org int64_t GetRtt() const; 672b19f0631233488e891d9db0d170b637dc8fc464pbos@webrtc.org 6829d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org private: 695cb9ce4c746867a02e7d37358f63e1a7c11ef262Peter Boström bool SetSendCodec(VideoCodec video_codec); 70be9d2a45499d87f3b04e644fc173b0d997a9eeeapbos@webrtc.org void ConfigureSsrcs(); 71e75a1bf45fb66f384701c375e77af3fe833b68cdpbos@webrtc.org TransportAdapter transport_adapter_; 724070935f4fb5b9fb2df246d7073fe0ba7e350791sprang@webrtc.org EncodedFrameCallbackAdapter encoded_frame_proxy_; 736ae48c660934784b4df56ab1ac99402ce3745e9fpbos@webrtc.org const VideoSendStream::Config config_; 74008731868a09e2fe01da53733a612dc24761f791pbos@webrtc.org VideoEncoderConfig encoder_config_; 752bb1bdab8d11f5445693c028335fb3ace631f636pbos@webrtc.org std::map<uint32_t, RtpState> suspended_ssrcs_; 7629d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org 77f16fcbec734e1e3303828525c9fd7e13e0803aabPeter Boström ProcessThread* const module_process_thread_; 7845553aefacb797818da83ccef1c3679a8aa0fc7fPeter Boström ChannelGroup* const channel_group_; 7945553aefacb797818da83ccef1c3679a8aa0fc7fPeter Boström const int channel_id_; 8059d91dc951143995069798edee05e757502f335cPeter Boström 814b91bd08979fcfb191cdae27ad24936beefce735Peter Boström rtc::scoped_ptr<VideoCaptureInput> input_; 8259d91dc951143995069798edee05e757502f335cPeter Boström ViEChannel* vie_channel_; 8359d91dc951143995069798edee05e757502f335cPeter Boström ViEEncoder* vie_encoder_; 8429d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org 8532452b20b8f5ea4470ec619a31eefc736e51c8a3pbos@webrtc.org // Used as a workaround to indicate that we should be using the configured 8632452b20b8f5ea4470ec619a31eefc736e51c8a3pbos@webrtc.org // start bitrate initially, instead of the one reported by VideoEngine (which 8732452b20b8f5ea4470ec619a31eefc736e51c8a3pbos@webrtc.org // defaults to too high). 88008731868a09e2fe01da53733a612dc24761f791pbos@webrtc.org bool use_config_bitrate_; 8932452b20b8f5ea4470ec619a31eefc736e51c8a3pbos@webrtc.org 90168f23faa5b8a49d4dd709c6649e77d5fecf36bfstefan@webrtc.org SendStatisticsProxy stats_proxy_; 9129d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org}; 9229d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org} // namespace internal 9329d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org} // namespace webrtc 9429d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org 95f3973e81d5aa7e4f1d6b5abdfe3a6dc53a32840cmflodman@webrtc.org#endif // WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_ 96