blob: a271d4827b10719e4c64dbd409f632b53c9ca983 [file] [log] [blame]
pbos@webrtc.org2a9108f2013-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#ifndef WEBRTC_VIDEO_ENGINE_VIDEO_CALL_IMPL_H_
11#define WEBRTC_VIDEO_ENGINE_VIDEO_CALL_IMPL_H_
12
13#include <map>
14#include <vector>
15
pbos@webrtc.org78ab5112013-08-05 12:49:22 +000016#include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h"
pbos@webrtc.org63988b22013-06-10 13:48:26 +000017#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
18#include "webrtc/system_wrappers/interface/scoped_ptr.h"
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000019#include "webrtc/video_engine/internal/video_receive_stream.h"
20#include "webrtc/video_engine/internal/video_send_stream.h"
pbos@webrtc.orgc2014fd2013-08-14 13:52:52 +000021#include "webrtc/video_engine/new_include/video_call.h"
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000022
23namespace webrtc {
24
25class VideoEngine;
26class ViERTP_RTCP;
27class ViECodec;
28
29namespace internal {
30
31// TODO(pbos): Split out the packet receiver, should be sharable between
32// VideoEngine and VoiceEngine.
pbos@webrtc.orgc1797062013-08-23 09:19:30 +000033class VideoCall : public webrtc::VideoCall, public PacketReceiver {
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000034 public:
35 VideoCall(webrtc::VideoEngine* video_engine,
pbos@webrtc.orgc1797062013-08-23 09:19:30 +000036 const VideoCall::Config& config);
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000037 virtual ~VideoCall();
38
pbos@webrtc.orgc1797062013-08-23 09:19:30 +000039 virtual PacketReceiver* Receiver() OVERRIDE;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000040 virtual std::vector<VideoCodec> GetVideoCodecs() OVERRIDE;
41
pbos@webrtc.orgc1797062013-08-23 09:19:30 +000042 virtual VideoSendStream::Config GetDefaultSendConfig() OVERRIDE;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000043
pbos@webrtc.orgc1797062013-08-23 09:19:30 +000044 virtual VideoSendStream* CreateSendStream(
45 const VideoSendStream::Config& config) OVERRIDE;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000046
pbos@webrtc.orgc1797062013-08-23 09:19:30 +000047 virtual SendStreamState* DestroySendStream(
48 webrtc::VideoSendStream* send_stream) OVERRIDE;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000049
pbos@webrtc.orgc1797062013-08-23 09:19:30 +000050 virtual VideoReceiveStream::Config GetDefaultReceiveConfig() OVERRIDE;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000051
pbos@webrtc.orgc1797062013-08-23 09:19:30 +000052 virtual VideoReceiveStream* CreateReceiveStream(
53 const VideoReceiveStream::Config& config) OVERRIDE;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000054
pbos@webrtc.orgc1797062013-08-23 09:19:30 +000055 virtual void DestroyReceiveStream(webrtc::VideoReceiveStream* receive_stream)
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000056 OVERRIDE;
57
58 virtual uint32_t SendBitrateEstimate() OVERRIDE;
59 virtual uint32_t ReceiveBitrateEstimate() OVERRIDE;
60
pbos@webrtc.org78ab5112013-08-05 12:49:22 +000061 virtual bool DeliverPacket(const uint8_t* packet, size_t length) OVERRIDE;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000062
63 private:
pbos@webrtc.org78ab5112013-08-05 12:49:22 +000064 bool DeliverRtcp(const uint8_t* packet, size_t length);
65 bool DeliverRtp(const RTPHeader& header,
66 const uint8_t* packet,
67 size_t length);
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000068
pbos@webrtc.orgc1797062013-08-23 09:19:30 +000069 VideoCall::Config config_;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000070
pbos@webrtc.org78ab5112013-08-05 12:49:22 +000071 std::map<uint32_t, VideoReceiveStream*> receive_ssrcs_;
pbos@webrtc.org63988b22013-06-10 13:48:26 +000072 scoped_ptr<RWLockWrapper> receive_lock_;
pbos@webrtc.org78ab5112013-08-05 12:49:22 +000073
74 std::map<uint32_t, VideoSendStream*> send_ssrcs_;
pbos@webrtc.org63988b22013-06-10 13:48:26 +000075 scoped_ptr<RWLockWrapper> send_lock_;
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000076
pbos@webrtc.org78ab5112013-08-05 12:49:22 +000077 scoped_ptr<RtpHeaderParser> rtp_header_parser_;
78
pbos@webrtc.org2a9108f2013-05-16 12:08:03 +000079 webrtc::VideoEngine* video_engine_;
80 ViERTP_RTCP* rtp_rtcp_;
81 ViECodec* codec_;
82
83 DISALLOW_COPY_AND_ASSIGN(VideoCall);
84};
85} // namespace internal
86} // namespace webrtc
87
88#endif // WEBRTC_VIDEO_ENGINE_INTERNAL_VIDEO_CALL_H_