blob: efc65f0cd9b02f767ad4579f3d7e52b064344548 [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 */
mflodman@webrtc.orgb429e512013-12-18 09:46:22 +000010#ifndef WEBRTC_CALL_H_
11#define WEBRTC_CALL_H_
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000012
13#include <string>
14#include <vector>
15
16#include "webrtc/common_types.h"
pbos@webrtc.org16e03b72013-10-28 16:32:01 +000017#include "webrtc/video_receive_stream.h"
18#include "webrtc/video_send_stream.h"
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000019
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
pbos@webrtc.org841c8a42013-09-09 15:04:25 +000034// 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.
37class Call {
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000038 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)
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +000041 : webrtc_config(NULL),
42 send_transport(send_transport),
pbos@webrtc.orgfd39e132013-08-14 13:52:52 +000043 overuse_detection(false),
44 voice_engine(NULL),
45 trace_callback(NULL),
pbos@webrtc.orgde74b642013-10-02 13:36:09 +000046 trace_filter(kTraceDefault) {}
mflodman@webrtc.org6879c8a2013-07-23 11:35:00 +000047
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +000048 webrtc::Config* webrtc_config;
49
pbos@webrtc.org74fa4892013-08-23 09:19:30 +000050 newapi::Transport* send_transport;
mflodman@webrtc.org6879c8a2013-07-23 11:35:00 +000051 bool overuse_detection;
pbos@webrtc.orgfd39e132013-08-14 13:52:52 +000052
pbos@webrtc.org841c8a42013-09-09 15:04:25 +000053 // VoiceEngine used for audio/video synchronization for this Call.
pbos@webrtc.orgfd39e132013-08-14 13:52:52 +000054 VoiceEngine* voice_engine;
55
56 TraceCallback* trace_callback;
57 uint32_t trace_filter;
mflodman@webrtc.org6879c8a2013-07-23 11:35:00 +000058 };
59
pbos@webrtc.org841c8a42013-09-09 15:04:25 +000060 static Call* Create(const Call::Config& config);
pbos@webrtc.orgfd39e132013-08-14 13:52:52 +000061
stefan@webrtc.org7e9315b2013-12-04 10:24:26 +000062 static Call* Create(const Call::Config& config,
63 const webrtc::Config& webrtc_config);
64
pbos@webrtc.org29d58392013-05-16 12:08:03 +000065 virtual std::vector<VideoCodec> GetVideoCodecs() = 0;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000066
pbos@webrtc.org025f4f12013-06-05 11:33:21 +000067 virtual VideoSendStream::Config GetDefaultSendConfig() = 0;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000068
pbos@webrtc.org5a636552013-11-20 10:40:25 +000069 virtual VideoSendStream* CreateVideoSendStream(
pbos@webrtc.org025f4f12013-06-05 11:33:21 +000070 const VideoSendStream::Config& config) = 0;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000071
pbos@webrtc.org2c46f8d2013-11-21 13:49:43 +000072 virtual void DestroyVideoSendStream(VideoSendStream* send_stream) = 0;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000073
pbos@webrtc.org025f4f12013-06-05 11:33:21 +000074 virtual VideoReceiveStream::Config GetDefaultReceiveConfig() = 0;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000075
pbos@webrtc.org5a636552013-11-20 10:40:25 +000076 virtual VideoReceiveStream* CreateVideoReceiveStream(
pbos@webrtc.org025f4f12013-06-05 11:33:21 +000077 const VideoReceiveStream::Config& config) = 0;
pbos@webrtc.org2c46f8d2013-11-21 13:49:43 +000078 virtual void DestroyVideoReceiveStream(
79 VideoReceiveStream* receive_stream) = 0;
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000080
81 // All received RTP and RTCP packets for the call should be inserted to this
82 // PacketReceiver. The PacketReceiver pointer is valid as long as the
pbos@webrtc.org841c8a42013-09-09 15:04:25 +000083 // Call instance exists.
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000084 virtual PacketReceiver* Receiver() = 0;
85
86 // Returns the estimated total send bandwidth. Note: this can differ from the
87 // actual encoded bitrate.
88 virtual uint32_t SendBitrateEstimate() = 0;
89
90 // Returns the total estimated receive bandwidth for the call. Note: this can
91 // differ from the actual receive bitrate.
92 virtual uint32_t ReceiveBitrateEstimate() = 0;
93
pbos@webrtc.org841c8a42013-09-09 15:04:25 +000094 virtual ~Call() {}
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000095};
mflodman@webrtc.org65f995a2013-04-18 12:02:52 +000096} // namespace webrtc
97
mflodman@webrtc.orgb429e512013-12-18 09:46:22 +000098#endif // WEBRTC_CALL_H_