2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
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.
10 #ifndef WEBRTC_CALL_H_
11 #define WEBRTC_CALL_H_
16 #include "webrtc/common_types.h"
17 #include "webrtc/video_receive_stream.h"
18 #include "webrtc/video_send_stream.h"
24 const char* Version();
26 class PacketReceiver {
30 DELIVERY_UNKNOWN_SSRC,
31 DELIVERY_PACKET_ERROR,
34 virtual DeliveryStatus DeliverPacket(const uint8_t* packet,
38 virtual ~PacketReceiver() {}
41 // Callback interface for reporting when a system overuse is detected.
42 // The detection is based on the jitter of incoming captured frames.
43 class OveruseCallback {
45 // Called as soon as an overuse is detected.
46 virtual void OnOveruse() = 0;
47 // Called periodically when the system is not overused any longer.
48 virtual void OnNormalUse() = 0;
51 virtual ~OveruseCallback() {}
54 // A Call instance can contain several send and/or receive streams. All streams
55 // are assumed to have the same remote endpoint and will share bitrate estimates
64 explicit Config(newapi::Transport* send_transport)
65 : webrtc_config(NULL),
66 send_transport(send_transport),
68 overuse_callback(NULL),
69 start_bitrate_bps(-1) {}
71 webrtc::Config* webrtc_config;
73 newapi::Transport* send_transport;
75 // VoiceEngine used for audio/video synchronization for this Call.
76 VoiceEngine* voice_engine;
78 // Callback for overuse and normal usage based on the jitter of incoming
79 // captured frames. 'NULL' disables the callback.
80 OveruseCallback* overuse_callback;
82 // Start bitrate used before a valid bitrate estimate is calculated. '-1'
83 // lets the call decide start bitrate.
84 // Note: This currently only affects video.
85 int start_bitrate_bps;
88 static Call* Create(const Call::Config& config);
90 static Call* Create(const Call::Config& config,
91 const webrtc::Config& webrtc_config);
93 virtual VideoSendStream* CreateVideoSendStream(
94 const VideoSendStream::Config& config,
95 const VideoEncoderConfig& encoder_config) = 0;
97 virtual void DestroyVideoSendStream(VideoSendStream* send_stream) = 0;
99 virtual VideoReceiveStream* CreateVideoReceiveStream(
100 const VideoReceiveStream::Config& config) = 0;
101 virtual void DestroyVideoReceiveStream(
102 VideoReceiveStream* receive_stream) = 0;
104 // All received RTP and RTCP packets for the call should be inserted to this
105 // PacketReceiver. The PacketReceiver pointer is valid as long as the
106 // Call instance exists.
107 virtual PacketReceiver* Receiver() = 0;
109 // Returns the estimated total send bandwidth. Note: this can differ from the
110 // actual encoded bitrate.
111 virtual uint32_t SendBitrateEstimate() = 0;
113 // Returns the total estimated receive bandwidth for the call. Note: this can
114 // differ from the actual receive bitrate.
115 virtual uint32_t ReceiveBitrateEstimate() = 0;
117 virtual void SignalNetworkState(NetworkState state) = 0;
121 } // namespace webrtc
123 #endif // WEBRTC_CALL_H_