pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 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 | #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.org | 78ab511 | 2013-08-05 12:49:22 +0000 | [diff] [blame] | 16 | #include "webrtc/modules/rtp_rtcp/interface/rtp_header_parser.h" |
pbos@webrtc.org | 63988b2 | 2013-06-10 13:48:26 +0000 | [diff] [blame] | 17 | #include "webrtc/system_wrappers/interface/rw_lock_wrapper.h" |
| 18 | #include "webrtc/system_wrappers/interface/scoped_ptr.h" |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 19 | #include "webrtc/video_engine/internal/video_receive_stream.h" |
| 20 | #include "webrtc/video_engine/internal/video_send_stream.h" |
pbos@webrtc.org | c2014fd | 2013-08-14 13:52:52 +0000 | [diff] [blame] | 21 | #include "webrtc/video_engine/new_include/video_call.h" |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 22 | |
| 23 | namespace webrtc { |
| 24 | |
| 25 | class VideoEngine; |
| 26 | class ViERTP_RTCP; |
| 27 | class ViECodec; |
| 28 | |
| 29 | namespace internal { |
| 30 | |
| 31 | // TODO(pbos): Split out the packet receiver, should be sharable between |
| 32 | // VideoEngine and VoiceEngine. |
pbos@webrtc.org | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame^] | 33 | class VideoCall : public webrtc::VideoCall, public PacketReceiver { |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 34 | public: |
| 35 | VideoCall(webrtc::VideoEngine* video_engine, |
pbos@webrtc.org | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame^] | 36 | const VideoCall::Config& config); |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 37 | virtual ~VideoCall(); |
| 38 | |
pbos@webrtc.org | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame^] | 39 | virtual PacketReceiver* Receiver() OVERRIDE; |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 40 | virtual std::vector<VideoCodec> GetVideoCodecs() OVERRIDE; |
| 41 | |
pbos@webrtc.org | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame^] | 42 | virtual VideoSendStream::Config GetDefaultSendConfig() OVERRIDE; |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 43 | |
pbos@webrtc.org | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame^] | 44 | virtual VideoSendStream* CreateSendStream( |
| 45 | const VideoSendStream::Config& config) OVERRIDE; |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 46 | |
pbos@webrtc.org | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame^] | 47 | virtual SendStreamState* DestroySendStream( |
| 48 | webrtc::VideoSendStream* send_stream) OVERRIDE; |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 49 | |
pbos@webrtc.org | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame^] | 50 | virtual VideoReceiveStream::Config GetDefaultReceiveConfig() OVERRIDE; |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 51 | |
pbos@webrtc.org | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame^] | 52 | virtual VideoReceiveStream* CreateReceiveStream( |
| 53 | const VideoReceiveStream::Config& config) OVERRIDE; |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 54 | |
pbos@webrtc.org | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame^] | 55 | virtual void DestroyReceiveStream(webrtc::VideoReceiveStream* receive_stream) |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 56 | OVERRIDE; |
| 57 | |
| 58 | virtual uint32_t SendBitrateEstimate() OVERRIDE; |
| 59 | virtual uint32_t ReceiveBitrateEstimate() OVERRIDE; |
| 60 | |
pbos@webrtc.org | 78ab511 | 2013-08-05 12:49:22 +0000 | [diff] [blame] | 61 | virtual bool DeliverPacket(const uint8_t* packet, size_t length) OVERRIDE; |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 62 | |
| 63 | private: |
pbos@webrtc.org | 78ab511 | 2013-08-05 12:49:22 +0000 | [diff] [blame] | 64 | 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.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 68 | |
pbos@webrtc.org | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame^] | 69 | VideoCall::Config config_; |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 70 | |
pbos@webrtc.org | 78ab511 | 2013-08-05 12:49:22 +0000 | [diff] [blame] | 71 | std::map<uint32_t, VideoReceiveStream*> receive_ssrcs_; |
pbos@webrtc.org | 63988b2 | 2013-06-10 13:48:26 +0000 | [diff] [blame] | 72 | scoped_ptr<RWLockWrapper> receive_lock_; |
pbos@webrtc.org | 78ab511 | 2013-08-05 12:49:22 +0000 | [diff] [blame] | 73 | |
| 74 | std::map<uint32_t, VideoSendStream*> send_ssrcs_; |
pbos@webrtc.org | 63988b2 | 2013-06-10 13:48:26 +0000 | [diff] [blame] | 75 | scoped_ptr<RWLockWrapper> send_lock_; |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 76 | |
pbos@webrtc.org | 78ab511 | 2013-08-05 12:49:22 +0000 | [diff] [blame] | 77 | scoped_ptr<RtpHeaderParser> rtp_header_parser_; |
| 78 | |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 79 | 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_ |