video_send_stream.h revision be9d2a45499d87f3b04e644fc173b0d997a9eeea
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
1429d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
154070935f4fb5b9fb2df246d7073fe0ba7e350791sprang@webrtc.org#include "webrtc/video/encoded_frame_callback_adapter.h"
16ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org#include "webrtc/video/send_statistics_proxy.h"
1716e03b7bd8b88ba569987e20a7f29061f91a3d0dpbos@webrtc.org#include "webrtc/video/transport_adapter.h"
1816e03b7bd8b88ba569987e20a7f29061f91a3d0dpbos@webrtc.org#include "webrtc/video_receive_stream.h"
1916e03b7bd8b88ba569987e20a7f29061f91a3d0dpbos@webrtc.org#include "webrtc/video_send_stream.h"
206488761f2e6ce7b977bbc14bc7b91933527d633apbos@webrtc.org#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
2129d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org
2229d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.orgnamespace webrtc {
2329d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org
24bdc5ed2e7d081de6597f0f993d54489eb3abd496asapersson@webrtc.orgclass CpuOveruseObserver;
2529d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.orgclass VideoEngine;
2629d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.orgclass ViEBase;
2729d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.orgclass ViECapture;
2829d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.orgclass ViECodec;
2929d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.orgclass ViEExternalCapture;
30360e3768729d40a10543641cee2cf56e0cf7dddestefan@webrtc.orgclass ViEExternalCodec;
31fe1ef935e7d35b465bd00744cc188f08198265b6pbos@webrtc.orgclass ViEImageProcess;
3229d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.orgclass ViENetwork;
3329d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.orgclass ViERTP_RTCP;
3429d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org
3529d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.orgnamespace internal {
366879c8adad604d51db200de56f9afe08282973a6mflodman@webrtc.org
3774fa4893f92add8f4601ef9779acb40b5ccd4e71pbos@webrtc.orgclass VideoSendStream : public webrtc::VideoSendStream,
38ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org                        public VideoSendStreamInput,
3909315705b9caf3bff455e3515b9bd99492a7c3e3sprang@webrtc.org                        public SendStatisticsProxy::StatsProvider {
4029d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org public:
4129d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org  VideoSendStream(newapi::Transport* transport,
42bdc5ed2e7d081de6597f0f993d54489eb3abd496asapersson@webrtc.org                  CpuOveruseObserver* overuse_observer,
4329d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org                  webrtc::VideoEngine* video_engine,
44f3973e81d5aa7e4f1d6b5abdfe3a6dc53a32840cmflodman@webrtc.org                  const VideoSendStream::Config& config,
456ae48c660934784b4df56ab1ac99402ce3745e9fpbos@webrtc.org                  const std::vector<VideoStream> video_streams,
466ae48c660934784b4df56ab1ac99402ce3745e9fpbos@webrtc.org                  const void* encoder_settings,
47eb16b811fb5c21954f9e4a6f4c64e297e9fd65b9mflodman@webrtc.org                  int base_channel,
48eb16b811fb5c21954f9e4a6f4c64e297e9fd65b9mflodman@webrtc.org                  int start_bitrate);
4929d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org
5029d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org  virtual ~VideoSendStream();
5129d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org
52a5c8d2c9b39a2d20fead2147e60ed0cd6d62019cpbos@webrtc.org  virtual void Start() OVERRIDE;
53a5c8d2c9b39a2d20fead2147e60ed0cd6d62019cpbos@webrtc.org  virtual void Stop() OVERRIDE;
5429d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org
55f577ae9eac9822380ea6f0fb953cf383d0ec5374pbos@webrtc.org  virtual bool ReconfigureVideoEncoder(const std::vector<VideoStream>& streams,
566ae48c660934784b4df56ab1ac99402ce3745e9fpbos@webrtc.org                                       const void* encoder_settings) OVERRIDE;
5729d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org
58ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org  virtual Stats GetStats() const OVERRIDE;
59ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org
60bbb07e69e55761ca43b38f929f3e39f4bba70ef1pbos@webrtc.org  bool DeliverRtcp(const uint8_t* packet, size_t length);
61bbb07e69e55761ca43b38f929f3e39f4bba70ef1pbos@webrtc.org
62ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org  // From VideoSendStreamInput.
63ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org  virtual void SwapFrame(I420VideoFrame* frame) OVERRIDE;
64ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org
65ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org  // From webrtc::VideoSendStream.
66ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org  virtual VideoSendStreamInput* Input() OVERRIDE;
67ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org
68ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org protected:
69ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org  // From SendStatisticsProxy::StreamStatsProvider.
70ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org  virtual bool GetSendSideDelay(VideoSendStream::Stats* stats) OVERRIDE;
71ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org  virtual std::string GetCName() OVERRIDE;
72ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org
7329d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org private:
74be9d2a45499d87f3b04e644fc173b0d997a9eeeapbos@webrtc.org  void ConfigureSsrcs();
75e75a1bf45fb66f384701c375e77af3fe833b68cdpbos@webrtc.org  TransportAdapter transport_adapter_;
764070935f4fb5b9fb2df246d7073fe0ba7e350791sprang@webrtc.org  EncodedFrameCallbackAdapter encoded_frame_proxy_;
776ae48c660934784b4df56ab1ac99402ce3745e9fpbos@webrtc.org  const VideoSendStream::Config config_;
78eb16b811fb5c21954f9e4a6f4c64e297e9fd65b9mflodman@webrtc.org  const int start_bitrate_bps_;
7929d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org
8029d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org  ViEBase* video_engine_base_;
8129d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org  ViECapture* capture_;
8229d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org  ViECodec* codec_;
8329d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org  ViEExternalCapture* external_capture_;
84360e3768729d40a10543641cee2cf56e0cf7dddestefan@webrtc.org  ViEExternalCodec* external_codec_;
8529d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org  ViENetwork* network_;
8629d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org  ViERTP_RTCP* rtp_rtcp_;
87fe1ef935e7d35b465bd00744cc188f08198265b6pbos@webrtc.org  ViEImageProcess* image_process_;
8829d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org
8929d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org  int channel_;
9029d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org  int capture_id_;
91ccd42840bcee8db145be91b3308912a24f710a6fsprang@webrtc.org
92de1429e9ad9a3a207ca191e1d748aa7271066860pbos@webrtc.org  const scoped_ptr<SendStatisticsProxy> stats_proxy_;
9329d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org};
9429d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org}  // namespace internal
9529d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org}  // namespace webrtc
9629d5839233b19743286a89676bd748a6bd8623d6pbos@webrtc.org
97f3973e81d5aa7e4f1d6b5abdfe3a6dc53a32840cmflodman@webrtc.org#endif  // WEBRTC_VIDEO_VIDEO_SEND_STREAM_H_
98