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