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" |
| 18 | #include "webrtc/video_engine/new_include/common.h" |
| 19 | #include "webrtc/video_engine/new_include/video_receive_stream.h" |
| 20 | #include "webrtc/video_engine/new_include/video_send_stream.h" |
| 21 | |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 22 | namespace webrtc { |
| 23 | namespace newapi { |
| 24 | |
| 25 | class VoiceEngine; |
| 26 | |
| 27 | const char* Version(); |
| 28 | |
| 29 | class PacketReceiver { |
| 30 | public: |
| 31 | virtual bool DeliverPacket(const void* packet, size_t length) = 0; |
| 32 | |
| 33 | protected: |
| 34 | virtual ~PacketReceiver() {} |
| 35 | }; |
| 36 | |
| 37 | struct VideoEngineConfig { |
| 38 | VideoEngineConfig() |
| 39 | : voice_engine(NULL), trace_callback(NULL), trace_filter(kTraceNone) {} |
| 40 | |
| 41 | // VoiceEngine used for audio/video synchronization for this VideoEngine. |
| 42 | VoiceEngine* voice_engine; |
| 43 | |
| 44 | TraceCallback* trace_callback; |
| 45 | uint32_t trace_filter; |
| 46 | }; |
| 47 | |
| 48 | // A VideoCall instance can contain several send and/or receive streams. All |
| 49 | // streams are assumed to have the same remote endpoint and will share bitrate |
| 50 | // estimates etc. |
| 51 | class VideoCall { |
| 52 | public: |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame^] | 53 | virtual std::vector<VideoCodec> GetVideoCodecs() = 0; |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 54 | |
| 55 | virtual void GetDefaultSendConfig(VideoSendStreamConfig* config) = 0; |
| 56 | |
| 57 | virtual VideoSendStream* CreateSendStream( |
| 58 | const VideoSendStreamConfig& config) = 0; |
| 59 | |
| 60 | // Returns the internal state of the send stream, for resume sending with a |
| 61 | // new stream with different settings. |
| 62 | // Note: Only the last returned send-stream state is valid. |
| 63 | virtual SendStreamState* DestroySendStream(VideoSendStream* send_stream) = 0; |
| 64 | |
| 65 | virtual void GetDefaultReceiveConfig(VideoReceiveStreamConfig* config) = 0; |
| 66 | |
| 67 | virtual VideoReceiveStream* CreateReceiveStream( |
| 68 | const VideoReceiveStreamConfig& config) = 0; |
| 69 | virtual void DestroyReceiveStream(VideoReceiveStream* receive_stream) = 0; |
| 70 | |
| 71 | // All received RTP and RTCP packets for the call should be inserted to this |
| 72 | // PacketReceiver. The PacketReceiver pointer is valid as long as the |
| 73 | // VideoCall instance exists. |
| 74 | virtual PacketReceiver* Receiver() = 0; |
| 75 | |
| 76 | // Returns the estimated total send bandwidth. Note: this can differ from the |
| 77 | // actual encoded bitrate. |
| 78 | virtual uint32_t SendBitrateEstimate() = 0; |
| 79 | |
| 80 | // Returns the total estimated receive bandwidth for the call. Note: this can |
| 81 | // differ from the actual receive bitrate. |
| 82 | virtual uint32_t ReceiveBitrateEstimate() = 0; |
| 83 | |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 84 | virtual ~VideoCall() {} |
| 85 | }; |
| 86 | |
| 87 | // VideoEngine is the main class and there is only one instance serving several |
| 88 | // calls. |
| 89 | class VideoEngine { |
| 90 | public: |
| 91 | static VideoEngine* Create(const VideoEngineConfig& engine_config); |
pbos@webrtc.org | 2a9108f | 2013-05-16 12:08:03 +0000 | [diff] [blame^] | 92 | virtual ~VideoEngine() {} |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 93 | |
| 94 | virtual VideoCall* CreateCall(Transport* send_transport) = 0; |
mflodman@webrtc.org | 06e8026 | 2013-04-18 12:02:52 +0000 | [diff] [blame] | 95 | }; |
| 96 | |
| 97 | } // namespace newapi |
| 98 | } // namespace webrtc |
| 99 | |
| 100 | #endif // WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_VIDEO_ENGINE_H_ |