blob: 96a93e5c66c429453e594df2dde17c87a8d3ead5 [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 */
pbos@webrtc.orgfd39e132013-08-14 13:52:52 +000010#ifndef WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_VIDEO_CALL_H_
11#define WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_VIDEO_CALL_H_
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000012
13#include <string>
14#include <vector>
15
16#include "webrtc/common_types.h"
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000017#include "webrtc/video_engine/new_include/video_receive_stream.h"
18#include "webrtc/video_engine/new_include/video_send_stream.h"
19
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000020namespace webrtc {
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000021
22class VoiceEngine;
23
24const char* Version();
25
26class PacketReceiver {
27 public:
pbos@webrtc.org40523702013-08-05 12:49:22 +000028 virtual bool DeliverPacket(const uint8_t* packet, size_t length) = 0;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000029
30 protected:
31 virtual ~PacketReceiver() {}
32};
33
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000034// A VideoCall instance can contain several send and/or receive streams. All
35// streams are assumed to have the same remote endpoint and will share bitrate
36// estimates etc.
37class VideoCall {
38 public:
mflodman@webrtc.org6879c8a2013-07-23 11:35:00 +000039 struct Config {
pbos@webrtc.org74fa4892013-08-23 09:19:30 +000040 explicit Config(newapi::Transport* send_transport)
pbos@webrtc.orgfd39e132013-08-14 13:52:52 +000041 : send_transport(send_transport),
42 overuse_detection(false),
43 voice_engine(NULL),
44 trace_callback(NULL),
45 trace_filter(kTraceNone) {}
mflodman@webrtc.org6879c8a2013-07-23 11:35:00 +000046
pbos@webrtc.org74fa4892013-08-23 09:19:30 +000047 newapi::Transport* send_transport;
mflodman@webrtc.org6879c8a2013-07-23 11:35:00 +000048 bool overuse_detection;
pbos@webrtc.orgfd39e132013-08-14 13:52:52 +000049
50 // VoiceEngine used for audio/video synchronization for this VideoCall.
51 VoiceEngine* voice_engine;
52
53 TraceCallback* trace_callback;
54 uint32_t trace_filter;
mflodman@webrtc.org6879c8a2013-07-23 11:35:00 +000055 };
56
pbos@webrtc.orgfd39e132013-08-14 13:52:52 +000057 static VideoCall* Create(const VideoCall::Config& config);
58
pbos@webrtc.org29d58392013-05-16 12:08:03 +000059 virtual std::vector<VideoCodec> GetVideoCodecs() = 0;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000060
pbos@webrtc.org025f4f12013-06-05 11:33:21 +000061 virtual VideoSendStream::Config GetDefaultSendConfig() = 0;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000062
63 virtual VideoSendStream* CreateSendStream(
pbos@webrtc.org025f4f12013-06-05 11:33:21 +000064 const VideoSendStream::Config& config) = 0;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000065
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.org025f4f12013-06-05 11:33:21 +000071 virtual VideoReceiveStream::Config GetDefaultReceiveConfig() = 0;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000072
73 virtual VideoReceiveStream* CreateReceiveStream(
pbos@webrtc.org025f4f12013-06-05 11:33:21 +000074 const VideoReceiveStream::Config& config) = 0;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000075 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.org65f995a2013-04-18 12:02:52 +000090 virtual ~VideoCall() {}
91};
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000092} // namespace webrtc
93
pbos@webrtc.orgfd39e132013-08-14 13:52:52 +000094#endif // WEBRTC_VIDEO_ENGINE_NEW_INCLUDE_VIDEO_CALL_H_