mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +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 | */ |
pbos@webrtc.org | bf6d572 | 2013-09-09 15:04:25 +0000 | [diff] [blame] | 10 | #ifndef WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_CALL_H_ |
| 11 | #define WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_CALL_H_ |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 12 | |
| 13 | #include <string> |
| 14 | #include <vector> |
| 15 | |
| 16 | #include "webrtc/common_types.h" |
pbos@webrtc.org | 24e2089 | 2013-10-28 16:32:01 +0000 | [diff] [blame] | 17 | #include "webrtc/video_receive_stream.h" |
| 18 | #include "webrtc/video_send_stream.h" |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 19 | |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 20 | namespace webrtc { |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 21 | |
| 22 | class VoiceEngine; |
| 23 | |
| 24 | const char* Version(); |
| 25 | |
| 26 | class PacketReceiver { |
| 27 | public: |
pbos@webrtc.org | 78ab511 | 2013-08-05 12:49:22 +0000 | [diff] [blame] | 28 | virtual bool DeliverPacket(const uint8_t* packet, size_t length) = 0; |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 29 | |
| 30 | protected: |
| 31 | virtual ~PacketReceiver() {} |
| 32 | }; |
| 33 | |
pbos@webrtc.org | bf6d572 | 2013-09-09 15:04:25 +0000 | [diff] [blame] | 34 | // A Call instance can contain several send and/or receive streams. All streams |
| 35 | // are assumed to have the same remote endpoint and will share bitrate estimates |
| 36 | // etc. |
| 37 | class Call { |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 38 | public: |
mflodman@webrtc.org | bf76ae2 | 2013-07-23 11:35:00 +0000 | [diff] [blame] | 39 | struct Config { |
pbos@webrtc.org | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame] | 40 | explicit Config(newapi::Transport* send_transport) |
pbos@webrtc.org | c2014fd | 2013-08-14 13:52:52 +0000 | [diff] [blame] | 41 | : send_transport(send_transport), |
| 42 | overuse_detection(false), |
| 43 | voice_engine(NULL), |
| 44 | trace_callback(NULL), |
pbos@webrtc.org | b5d2d16 | 2013-10-02 13:36:09 +0000 | [diff] [blame] | 45 | trace_filter(kTraceDefault) {} |
mflodman@webrtc.org | bf76ae2 | 2013-07-23 11:35:00 +0000 | [diff] [blame] | 46 | |
pbos@webrtc.org | c179706 | 2013-08-23 09:19:30 +0000 | [diff] [blame] | 47 | newapi::Transport* send_transport; |
mflodman@webrtc.org | bf76ae2 | 2013-07-23 11:35:00 +0000 | [diff] [blame] | 48 | bool overuse_detection; |
pbos@webrtc.org | c2014fd | 2013-08-14 13:52:52 +0000 | [diff] [blame] | 49 | |
pbos@webrtc.org | bf6d572 | 2013-09-09 15:04:25 +0000 | [diff] [blame] | 50 | // VoiceEngine used for audio/video synchronization for this Call. |
pbos@webrtc.org | c2014fd | 2013-08-14 13:52:52 +0000 | [diff] [blame] | 51 | VoiceEngine* voice_engine; |
| 52 | |
| 53 | TraceCallback* trace_callback; |
| 54 | uint32_t trace_filter; |
mflodman@webrtc.org | bf76ae2 | 2013-07-23 11:35:00 +0000 | [diff] [blame] | 55 | }; |
| 56 | |
pbos@webrtc.org | bf6d572 | 2013-09-09 15:04:25 +0000 | [diff] [blame] | 57 | static Call* Create(const Call::Config& config); |
pbos@webrtc.org | c2014fd | 2013-08-14 13:52:52 +0000 | [diff] [blame] | 58 | |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 59 | virtual std::vector<VideoCodec> GetVideoCodecs() = 0; |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 60 | |
pbos@webrtc.org | 6f1c3ef | 2013-06-05 11:33:21 +0000 | [diff] [blame] | 61 | virtual VideoSendStream::Config GetDefaultSendConfig() = 0; |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 62 | |
pbos@webrtc.org | 964d78e | 2013-11-20 10:40:25 +0000 | [diff] [blame] | 63 | virtual VideoSendStream* CreateVideoSendStream( |
pbos@webrtc.org | 6f1c3ef | 2013-06-05 11:33:21 +0000 | [diff] [blame] | 64 | const VideoSendStream::Config& config) = 0; |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 65 | |
| 66 | // Returns the internal state of the send stream, for resume sending with a |
| 67 | // new stream with different settings. |
| 68 | // Note: Only the last returned send-stream state is valid. |
pbos@webrtc.org | 12a93e0 | 2013-11-21 13:49:43 +0000 | [diff] [blame^] | 69 | virtual void DestroyVideoSendStream(VideoSendStream* send_stream) = 0; |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 70 | |
pbos@webrtc.org | 6f1c3ef | 2013-06-05 11:33:21 +0000 | [diff] [blame] | 71 | virtual VideoReceiveStream::Config GetDefaultReceiveConfig() = 0; |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 72 | |
pbos@webrtc.org | 964d78e | 2013-11-20 10:40:25 +0000 | [diff] [blame] | 73 | virtual VideoReceiveStream* CreateVideoReceiveStream( |
pbos@webrtc.org | 6f1c3ef | 2013-06-05 11:33:21 +0000 | [diff] [blame] | 74 | const VideoReceiveStream::Config& config) = 0; |
pbos@webrtc.org | 12a93e0 | 2013-11-21 13:49:43 +0000 | [diff] [blame^] | 75 | virtual void DestroyVideoReceiveStream( |
| 76 | VideoReceiveStream* receive_stream) = 0; |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 77 | |
| 78 | // All received RTP and RTCP packets for the call should be inserted to this |
| 79 | // PacketReceiver. The PacketReceiver pointer is valid as long as the |
pbos@webrtc.org | bf6d572 | 2013-09-09 15:04:25 +0000 | [diff] [blame] | 80 | // Call instance exists. |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 81 | virtual PacketReceiver* Receiver() = 0; |
| 82 | |
| 83 | // Returns the estimated total send bandwidth. Note: this can differ from the |
| 84 | // actual encoded bitrate. |
| 85 | virtual uint32_t SendBitrateEstimate() = 0; |
| 86 | |
| 87 | // Returns the total estimated receive bandwidth for the call. Note: this can |
| 88 | // differ from the actual receive bitrate. |
| 89 | virtual uint32_t ReceiveBitrateEstimate() = 0; |
| 90 | |
pbos@webrtc.org | bf6d572 | 2013-09-09 15:04:25 +0000 | [diff] [blame] | 91 | virtual ~Call() {} |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 92 | }; |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 93 | } // namespace webrtc |
| 94 | |
pbos@webrtc.org | bf6d572 | 2013-09-09 15:04:25 +0000 | [diff] [blame] | 95 | #endif // WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_CALL_H_ |