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 | */ |
| 10 | |
| 11 | #ifndef WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_VIDEO_ENGINE_H_ |
| 12 | #define WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_VIDEO_ENGINE_H_ |
| 13 | |
| 14 | #include <string> |
| 15 | #include <vector> |
| 16 | |
| 17 | #include "webrtc/common_types.h" |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 18 | #include "webrtc/video_engine/new_include/video_receive_stream.h" |
| 19 | #include "webrtc/video_engine/new_include/video_send_stream.h" |
| 20 | |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 21 | namespace webrtc { |
| 22 | namespace newapi { |
| 23 | |
| 24 | class VoiceEngine; |
| 25 | |
| 26 | const char* Version(); |
| 27 | |
| 28 | class PacketReceiver { |
| 29 | public: |
| 30 | virtual bool DeliverPacket(const void* packet, size_t length) = 0; |
| 31 | |
| 32 | protected: |
| 33 | virtual ~PacketReceiver() {} |
| 34 | }; |
| 35 | |
| 36 | struct VideoEngineConfig { |
| 37 | VideoEngineConfig() |
| 38 | : voice_engine(NULL), trace_callback(NULL), trace_filter(kTraceNone) {} |
| 39 | |
| 40 | // VoiceEngine used for audio/video synchronization for this VideoEngine. |
| 41 | VoiceEngine* voice_engine; |
| 42 | |
| 43 | TraceCallback* trace_callback; |
| 44 | uint32_t trace_filter; |
| 45 | }; |
| 46 | |
| 47 | // A VideoCall instance can contain several send and/or receive streams. All |
| 48 | // streams are assumed to have the same remote endpoint and will share bitrate |
| 49 | // estimates etc. |
| 50 | class VideoCall { |
| 51 | public: |
mflodman@webrtc.org | bf76ae2 | 2013-07-23 11:35:00 +0000 | [diff] [blame] | 52 | struct Config { |
| 53 | Config() : send_transport(NULL), overuse_detection(false) {} |
| 54 | |
| 55 | Transport* send_transport; |
| 56 | bool overuse_detection; |
| 57 | }; |
| 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 | |
| 63 | virtual VideoSendStream* CreateSendStream( |
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. |
| 69 | virtual SendStreamState* DestroySendStream(VideoSendStream* send_stream) = 0; |
| 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 | |
| 73 | virtual VideoReceiveStream* CreateReceiveStream( |
pbos@webrtc.org | 6f1c3ef | 2013-06-05 11:33:21 +0000 | [diff] [blame] | 74 | const VideoReceiveStream::Config& config) = 0; |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 75 | virtual void DestroyReceiveStream(VideoReceiveStream* receive_stream) = 0; |
| 76 | |
| 77 | // All received RTP and RTCP packets for the call should be inserted to this |
| 78 | // PacketReceiver. The PacketReceiver pointer is valid as long as the |
| 79 | // VideoCall instance exists. |
| 80 | virtual PacketReceiver* Receiver() = 0; |
| 81 | |
| 82 | // Returns the estimated total send bandwidth. Note: this can differ from the |
| 83 | // actual encoded bitrate. |
| 84 | virtual uint32_t SendBitrateEstimate() = 0; |
| 85 | |
| 86 | // Returns the total estimated receive bandwidth for the call. Note: this can |
| 87 | // differ from the actual receive bitrate. |
| 88 | virtual uint32_t ReceiveBitrateEstimate() = 0; |
| 89 | |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 90 | virtual ~VideoCall() {} |
| 91 | }; |
| 92 | |
| 93 | // VideoEngine is the main class and there is only one instance serving several |
| 94 | // calls. |
| 95 | class VideoEngine { |
| 96 | public: |
mflodman@webrtc.org | bf76ae2 | 2013-07-23 11:35:00 +0000 | [diff] [blame] | 97 | static VideoEngine* Create(const VideoEngineConfig& config); |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 98 | virtual ~VideoEngine() {} |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 99 | |
mflodman@webrtc.org | bf76ae2 | 2013-07-23 11:35:00 +0000 | [diff] [blame] | 100 | virtual VideoCall* CreateCall(const VideoCall::Config& config) = 0; |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 101 | }; |
| 102 | |
| 103 | } // namespace newapi |
| 104 | } // namespace webrtc |
| 105 | |
| 106 | #endif // WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_VIDEO_ENGINE_H_ |