mflodman@webrtc.org | 65f995a | 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 | 841c8a4 | 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 | 65f995a | 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 | 16e03b7 | 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 | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 19 | |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 20 | namespace webrtc { |
mflodman@webrtc.org | 65f995a | 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 | 4052370 | 2013-08-05 12:49:22 +0000 | [diff] [blame] | 28 | virtual bool DeliverPacket(const uint8_t* packet, size_t length) = 0; |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 29 | |
| 30 | protected: |
| 31 | virtual ~PacketReceiver() {} |
| 32 | }; |
| 33 | |
pbos@webrtc.org | 841c8a4 | 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 | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 38 | public: |
mflodman@webrtc.org | 6879c8a | 2013-07-23 11:35:00 +0000 | [diff] [blame] | 39 | struct Config { |
pbos@webrtc.org | 74fa489 | 2013-08-23 09:19:30 +0000 | [diff] [blame] | 40 | explicit Config(newapi::Transport* send_transport) |
stefan@webrtc.org | 7e9315b | 2013-12-04 10:24:26 +0000 | [diff] [blame^] | 41 | : webrtc_config(NULL), |
| 42 | send_transport(send_transport), |
pbos@webrtc.org | fd39e13 | 2013-08-14 13:52:52 +0000 | [diff] [blame] | 43 | overuse_detection(false), |
| 44 | voice_engine(NULL), |
| 45 | trace_callback(NULL), |
pbos@webrtc.org | de74b64 | 2013-10-02 13:36:09 +0000 | [diff] [blame] | 46 | trace_filter(kTraceDefault) {} |
mflodman@webrtc.org | 6879c8a | 2013-07-23 11:35:00 +0000 | [diff] [blame] | 47 | |
stefan@webrtc.org | 7e9315b | 2013-12-04 10:24:26 +0000 | [diff] [blame^] | 48 | webrtc::Config* webrtc_config; |
| 49 | |
pbos@webrtc.org | 74fa489 | 2013-08-23 09:19:30 +0000 | [diff] [blame] | 50 | newapi::Transport* send_transport; |
mflodman@webrtc.org | 6879c8a | 2013-07-23 11:35:00 +0000 | [diff] [blame] | 51 | bool overuse_detection; |
pbos@webrtc.org | fd39e13 | 2013-08-14 13:52:52 +0000 | [diff] [blame] | 52 | |
pbos@webrtc.org | 841c8a4 | 2013-09-09 15:04:25 +0000 | [diff] [blame] | 53 | // VoiceEngine used for audio/video synchronization for this Call. |
pbos@webrtc.org | fd39e13 | 2013-08-14 13:52:52 +0000 | [diff] [blame] | 54 | VoiceEngine* voice_engine; |
| 55 | |
| 56 | TraceCallback* trace_callback; |
| 57 | uint32_t trace_filter; |
mflodman@webrtc.org | 6879c8a | 2013-07-23 11:35:00 +0000 | [diff] [blame] | 58 | }; |
| 59 | |
pbos@webrtc.org | 841c8a4 | 2013-09-09 15:04:25 +0000 | [diff] [blame] | 60 | static Call* Create(const Call::Config& config); |
pbos@webrtc.org | fd39e13 | 2013-08-14 13:52:52 +0000 | [diff] [blame] | 61 | |
stefan@webrtc.org | 7e9315b | 2013-12-04 10:24:26 +0000 | [diff] [blame^] | 62 | static Call* Create(const Call::Config& config, |
| 63 | const webrtc::Config& webrtc_config); |
| 64 | |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 65 | virtual std::vector<VideoCodec> GetVideoCodecs() = 0; |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 66 | |
pbos@webrtc.org | 025f4f1 | 2013-06-05 11:33:21 +0000 | [diff] [blame] | 67 | virtual VideoSendStream::Config GetDefaultSendConfig() = 0; |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 68 | |
pbos@webrtc.org | 5a63655 | 2013-11-20 10:40:25 +0000 | [diff] [blame] | 69 | virtual VideoSendStream* CreateVideoSendStream( |
pbos@webrtc.org | 025f4f1 | 2013-06-05 11:33:21 +0000 | [diff] [blame] | 70 | const VideoSendStream::Config& config) = 0; |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 71 | |
| 72 | // Returns the internal state of the send stream, for resume sending with a |
| 73 | // new stream with different settings. |
| 74 | // Note: Only the last returned send-stream state is valid. |
pbos@webrtc.org | 2c46f8d | 2013-11-21 13:49:43 +0000 | [diff] [blame] | 75 | virtual void DestroyVideoSendStream(VideoSendStream* send_stream) = 0; |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 76 | |
pbos@webrtc.org | 025f4f1 | 2013-06-05 11:33:21 +0000 | [diff] [blame] | 77 | virtual VideoReceiveStream::Config GetDefaultReceiveConfig() = 0; |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 78 | |
pbos@webrtc.org | 5a63655 | 2013-11-20 10:40:25 +0000 | [diff] [blame] | 79 | virtual VideoReceiveStream* CreateVideoReceiveStream( |
pbos@webrtc.org | 025f4f1 | 2013-06-05 11:33:21 +0000 | [diff] [blame] | 80 | const VideoReceiveStream::Config& config) = 0; |
pbos@webrtc.org | 2c46f8d | 2013-11-21 13:49:43 +0000 | [diff] [blame] | 81 | virtual void DestroyVideoReceiveStream( |
| 82 | VideoReceiveStream* receive_stream) = 0; |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 83 | |
| 84 | // All received RTP and RTCP packets for the call should be inserted to this |
| 85 | // PacketReceiver. The PacketReceiver pointer is valid as long as the |
pbos@webrtc.org | 841c8a4 | 2013-09-09 15:04:25 +0000 | [diff] [blame] | 86 | // Call instance exists. |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 87 | virtual PacketReceiver* Receiver() = 0; |
| 88 | |
| 89 | // Returns the estimated total send bandwidth. Note: this can differ from the |
| 90 | // actual encoded bitrate. |
| 91 | virtual uint32_t SendBitrateEstimate() = 0; |
| 92 | |
| 93 | // Returns the total estimated receive bandwidth for the call. Note: this can |
| 94 | // differ from the actual receive bitrate. |
| 95 | virtual uint32_t ReceiveBitrateEstimate() = 0; |
| 96 | |
pbos@webrtc.org | 841c8a4 | 2013-09-09 15:04:25 +0000 | [diff] [blame] | 97 | virtual ~Call() {} |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 98 | }; |
mflodman@webrtc.org | 65f995a | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 99 | } // namespace webrtc |
| 100 | |
pbos@webrtc.org | 841c8a4 | 2013-09-09 15:04:25 +0000 | [diff] [blame] | 101 | #endif // WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_CALL_H_ |