Agora RTC Objective-C API Reference Refactor

NGIAgoraVideoTrack.h
Go to the documentation of this file.
1
2 // Copyright (c) 2019 Agora.io. All rights reserved
3
4 // This program is confidential and proprietary to Agora.io.
5 // And may not be copied, reproduced, modified, disclosed to others, published
6 // or used, in whole or in part, without the express prior written permission
7 // of Agora.io.
8
9 #pragma once // NOLINT(build/header_guard)
10
11 #include "AgoraBase.h"
12
13 #ifndef OPTIONAL_OVERRIDE
14 #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
15 #define OPTIONAL_OVERRIDE override
16 #else
17 #define OPTIONAL_OVERRIDE
18 #endif
19 #endif
20
21 namespace agora {
22 namespace rtc {
23 class IVideoFilter;
24 class IVideoEncodedFrameObserver;
25 class IMediaPacketReceiver;
26 class IVideoSinkBase;
27
28 enum VideoTrackType {
29 LOCAL_VIDEO_TRACK,
30 REMOTE_VIDEO_TRACK,
31 REMOTE_VIDEO_IMAGE_TRACK,
32 };
33
37 class IVideoTrack : public RefCountInterface {
38 public:
56 virtual bool addVideoFilter(
57 agora_refptr<IVideoFilter> filter, media::base::VIDEO_MODULE_POSITION position = media::base::POSITION_POST_CAPTURER,
58 const char* id = NULL) = 0;
59
70 virtual bool removeVideoFilter(
71 agora_refptr<IVideoFilter> filter, media::base::VIDEO_MODULE_POSITION position = media::base::POSITION_POST_CAPTURER,
72 const char* id = NULL) = 0;
73
81 virtual bool hasVideoFilter(const char* id, media::base::VIDEO_MODULE_POSITION position = media::base::POSITION_POST_CAPTURER) = 0;
82
97 virtual bool addRenderer(agora_refptr<IVideoSinkBase> videoRenderer, media::base::VIDEO_MODULE_POSITION position = media::base::POSITION_PRE_RENDERER) = 0;
107 virtual bool removeRenderer(agora_refptr<IVideoSinkBase> videoRenderer, media::base::VIDEO_MODULE_POSITION position = media::base::POSITION_PRE_RENDERER) = 0;
113 virtual VideoTrackType getType() = 0;
114
123 virtual int enableVideoFilter(const char* id, bool enable) { return -1; }
124
134 virtual int setFilterProperty(const char* id, const char* key, const char* json_value) { return -1; }
135
145 virtual int getFilterProperty(const char* id, const char* key, char* json_value, size_t buf_size) { return -1; }
146
147 protected:
148 ~IVideoTrack() {}
149 };
150
154 struct LocalVideoTrackStats {
158 uint64_t number_of_streams;
162 uint64_t bytes_major_stream;
166 uint64_t bytes_minor_stream;
170 uint32_t frames_encoded;
174 uint32_t ssrc_major_stream;
178 uint32_t ssrc_minor_stream;
182 int capture_frame_rate;
186 int regulated_capture_frame_rate;
190 int input_frame_rate;
194 int encode_frame_rate;
198 int render_frame_rate;
202 int target_media_bitrate_bps;
206 int media_bitrate_bps;
210 int total_bitrate_bps; // Include FEC
214 int capture_width;
218 int capture_height;
222 int regulated_capture_width;
226 int regulated_capture_height;
230 int width;
234 int height;
235 uint32_t encoder_type;
236 uint32_t hw_encoder_accelerating;
240 uint32_t uplink_cost_time_ms;
244 QUALITY_ADAPT_INDICATION quality_adapt_indication;
248 unsigned short txPacketLossRate;
249
252 CAPTURE_BRIGHTNESS_LEVEL_TYPE capture_brightness_level;
253
254 LocalVideoTrackStats() : number_of_streams(0),
255 bytes_major_stream(0),
256 bytes_minor_stream(0),
257 frames_encoded(0),
258 ssrc_major_stream(0),
259 ssrc_minor_stream(0),
260 capture_frame_rate(0),
261 regulated_capture_frame_rate(0),
262 input_frame_rate(0),
263 encode_frame_rate(0),
264 render_frame_rate(0),
265 target_media_bitrate_bps(0),
266 media_bitrate_bps(0),
267 total_bitrate_bps(0),
268 capture_width(0),
269 capture_height(0),
270 regulated_capture_width(0),
271 regulated_capture_height(0),
272 width(0),
273 height(0),
274 encoder_type(0),
275 uplink_cost_time_ms(0),
276 quality_adapt_indication(ADAPT_NONE),
277 txPacketLossRate(0),
278 capture_brightness_level(CAPTURE_BRIGHTNESS_LEVEL_INVALID) {}
279 };
280
292 class ILocalVideoTrack : public IVideoTrack {
293 public:
303 virtual void setEnabled(bool enable) = 0;
304
321 virtual int setVideoEncoderConfiguration(const VideoEncoderConfiguration& config) = 0;
322
332 virtual int setSimulcastStreamMode(SIMULCAST_STREAM_MODE mode, const SimulcastStreamConfig& config) = 0;
333
339 virtual LOCAL_VIDEO_STREAM_STATE getState() = 0;
340
349 virtual bool getStatistics(LocalVideoTrackStats& stats) = 0;
350
351 virtual VideoTrackType getType() OPTIONAL_OVERRIDE { return LOCAL_VIDEO_TRACK; }
352
353 protected:
354 ~ILocalVideoTrack() {}
355 };
359 struct RemoteVideoTrackStats {
363 uid_t uid;
367 int delay;
371 int e2eDelay;
375 int width;
379 int height;
383 int receivedBitrate;
386 int decoderOutputFrameRate;
389 int rendererOutputFrameRate;
392 int frameLossRate;
395 int packetLossRate;
399 VIDEO_STREAM_TYPE rxStreamType;
405 int totalFrozenTime;
409 int frozenRate;
413 uint32_t received_bytes;
417 uint32_t totalDecodedFrames;
422 int avSyncTimeMs;
427 uint32_t downlink_process_time_ms;
431 uint32_t frame_render_delay_ms;
436 uint64_t totalActiveTime;
440 uint64_t publishDuration;
444 int vqa_mos;
448 int vqa_avg_cost_ms;
449
450 RemoteVideoTrackStats() : uid(0), delay(0), width(0), height(0),
451 receivedBitrate(0), decoderOutputFrameRate(0), rendererOutputFrameRate(0),
452 frameLossRate(0), packetLossRate(0), rxStreamType(VIDEO_STREAM_HIGH),
453 totalFrozenTime(0), frozenRate(0), received_bytes(0), totalDecodedFrames(0), avSyncTimeMs(0),
454 downlink_process_time_ms(0), frame_render_delay_ms(0), totalActiveTime(0),
455 publishDuration(0), vqa_mos(0), vqa_avg_cost_ms(0) {}
456 };
457
461 class IRemoteVideoTrack : public IVideoTrack {
462 public:
470 virtual bool getStatistics(RemoteVideoTrackStats& stats) = 0;
475 virtual REMOTE_VIDEO_STATE getState() = 0;
483 virtual bool getTrackInfo(VideoTrackInfo& info) = 0;
496 virtual int registerVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver* encodedObserver) = 0;
504 virtual int unregisterVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver* encodedObserver) = 0;
505
518 virtual int registerMediaPacketReceiver(IMediaPacketReceiver* videoReceiver) = 0;
526 virtual int unregisterMediaPacketReceiver(IMediaPacketReceiver* videoReceiver) = 0;
527
528 virtual VideoTrackType getType() OPTIONAL_OVERRIDE { return REMOTE_VIDEO_TRACK; }
529
530 protected:
531 ~IRemoteVideoTrack() {}
532 };
533
534 } // namespace rtc
535 } // namespace agora
agora::rtc::RemoteVideoTrackStats::rxStreamType
VIDEO_STREAM_TYPE rxStreamType
Definition: NGIAgoraVideoTrack.h:399
agora::media::base::VIDEO_MODULE_POSITION
VIDEO_MODULE_POSITION
Definition: AgoraMediaBase.h:983
agora::rtc::IVideoTrack::enableVideoFilter
virtual int enableVideoFilter(const char *id, bool enable)
Definition: NGIAgoraVideoTrack.h:123
agora::rtc::RemoteVideoTrackStats::e2eDelay
int e2eDelay
Definition: NGIAgoraVideoTrack.h:371
agora::rtc::LocalVideoTrackStats::number_of_streams
uint64_t number_of_streams
Definition: NGIAgoraVideoTrack.h:158
agora::rtc::LocalVideoTrackStats::width
int width
Definition: NGIAgoraVideoTrack.h:230
AgoraBase.h
agora::rtc::RemoteVideoTrackStats::frozenRate
int frozenRate
Definition: NGIAgoraVideoTrack.h:409
agora::rtc::LocalVideoTrackStats::capture_frame_rate
int capture_frame_rate
Definition: NGIAgoraVideoTrack.h:182
agora::rtc::LocalVideoTrackStats::encode_frame_rate
int encode_frame_rate
Definition: NGIAgoraVideoTrack.h:194
agora::rtc::IVideoTrack::addVideoFilter
virtual bool addVideoFilter(agora_refptr< IVideoFilter > filter, media::base::VIDEO_MODULE_POSITION position=media::base::POSITION_POST_CAPTURER, const char *id=NULL)=0
agora::rtc::IVideoTrack
Definition: NGIAgoraVideoTrack.h:37
agora::rtc::uid_t
unsigned int uid_t
Definition: AgoraMediaBase.h:29
agora::rtc::RemoteVideoTrackStats::downlink_process_time_ms
uint32_t downlink_process_time_ms
Definition: NGIAgoraVideoTrack.h:427
agora::agora_refptr
Definition: AgoraRefPtr.h:44
agora::rtc::QUALITY_ADAPT_INDICATION
QUALITY_ADAPT_INDICATION
Definition: AgoraBase.h:2312
agora::rtc::LocalVideoTrackStats::regulated_capture_height
int regulated_capture_height
Definition: NGIAgoraVideoTrack.h:226
agora::rtc::REMOTE_VIDEO_IMAGE_TRACK
@ REMOTE_VIDEO_IMAGE_TRACK
Definition: NGIAgoraVideoTrack.h:31
agora::rtc::ADAPT_NONE
@ ADAPT_NONE
Definition: AgoraBase.h:2316
agora::rtc::IVideoTrack::~IVideoTrack
~IVideoTrack()
Definition: NGIAgoraVideoTrack.h:148
agora::rtc::LocalVideoTrackStats::txPacketLossRate
unsigned short txPacketLossRate
Definition: NGIAgoraVideoTrack.h:248
agora::rtc::RemoteVideoTrackStats::vqa_mos
int vqa_mos
Definition: NGIAgoraVideoTrack.h:444
agora::rtc::RemoteVideoTrackStats::vqa_avg_cost_ms
int vqa_avg_cost_ms
Definition: NGIAgoraVideoTrack.h:448
agora::rtc::ILocalVideoTrack::~ILocalVideoTrack
~ILocalVideoTrack()
Definition: NGIAgoraVideoTrack.h:354
agora::rtc::LocalVideoTrackStats::target_media_bitrate_bps
int target_media_bitrate_bps
Definition: NGIAgoraVideoTrack.h:202
agora::rtc::LocalVideoTrackStats::render_frame_rate
int render_frame_rate
Definition: NGIAgoraVideoTrack.h:198
agora::rtc::VideoEncoderConfiguration
Definition: AgoraBase.h:1775
agora::rtc::IRemoteVideoTrack::getTrackInfo
virtual bool getTrackInfo(VideoTrackInfo &info)=0
agora::rtc::LocalVideoTrackStats::input_frame_rate
int input_frame_rate
Definition: NGIAgoraVideoTrack.h:190
agora::rtc::RemoteVideoTrackStats::received_bytes
uint32_t received_bytes
Definition: NGIAgoraVideoTrack.h:413
agora::rtc::LocalVideoTrackStats::regulated_capture_width
int regulated_capture_width
Definition: NGIAgoraVideoTrack.h:222
agora::rtc::IVideoTrack::hasVideoFilter
virtual bool hasVideoFilter(const char *id, media::base::VIDEO_MODULE_POSITION position=media::base::POSITION_POST_CAPTURER)=0
agora::rtc::IRemoteVideoTrack::~IRemoteVideoTrack
~IRemoteVideoTrack()
Definition: NGIAgoraVideoTrack.h:531
agora::rtc::RemoteVideoTrackStats::height
int height
Definition: NGIAgoraVideoTrack.h:379
agora::rtc::RemoteVideoTrackStats::totalFrozenTime
int totalFrozenTime
Definition: NGIAgoraVideoTrack.h:405
agora::rtc::RemoteVideoTrackStats::totalActiveTime
uint64_t totalActiveTime
Definition: NGIAgoraVideoTrack.h:436
agora::rtc::SimulcastStreamConfig
Definition: AgoraBase.h:1985
agora::rtc::VideoTrackType
VideoTrackType
Definition: NGIAgoraVideoTrack.h:28
agora::rtc::IVideoTrack::getFilterProperty
virtual int getFilterProperty(const char *id, const char *key, char *json_value, size_t buf_size)
Definition: NGIAgoraVideoTrack.h:145
agora::rtc::LocalVideoTrackStats::hw_encoder_accelerating
uint32_t hw_encoder_accelerating
Definition: NGIAgoraVideoTrack.h:236
agora::rtc::IRemoteVideoTrack::registerVideoEncodedFrameObserver
virtual int registerVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver *encodedObserver)=0
agora
Definition: AgoraAtomicOps.h:21
agora::rtc::LocalVideoTrackStats::capture_width
int capture_width
Definition: NGIAgoraVideoTrack.h:214
agora::rtc::IVideoTrack::removeVideoFilter
virtual bool removeVideoFilter(agora_refptr< IVideoFilter > filter, media::base::VIDEO_MODULE_POSITION position=media::base::POSITION_POST_CAPTURER, const char *id=NULL)=0
agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_TYPE
CAPTURE_BRIGHTNESS_LEVEL_TYPE
Definition: AgoraBase.h:2606
agora::rtc::SIMULCAST_STREAM_MODE
SIMULCAST_STREAM_MODE
Definition: AgoraBase.h:1967
agora::rtc::IVideoTrack::removeRenderer
virtual bool removeRenderer(agora_refptr< IVideoSinkBase > videoRenderer, media::base::VIDEO_MODULE_POSITION position=media::base::POSITION_PRE_RENDERER)=0
agora::rtc::REMOTE_VIDEO_STATE
REMOTE_VIDEO_STATE
Definition: AgoraBase.h:2946
agora::rtc::ILocalVideoTrack::getType
virtual VideoTrackType getType() OPTIONAL_OVERRIDE
Definition: NGIAgoraVideoTrack.h:351
agora::rtc::LOCAL_VIDEO_STREAM_STATE
LOCAL_VIDEO_STREAM_STATE
Definition: AgoraBase.h:2716
agora::rtc::IVideoTrack::getType
virtual VideoTrackType getType()=0
agora::rtc::LocalVideoTrackStats::ssrc_major_stream
uint32_t ssrc_major_stream
Definition: NGIAgoraVideoTrack.h:174
agora::rtc::LocalVideoTrackStats::regulated_capture_frame_rate
int regulated_capture_frame_rate
Definition: NGIAgoraVideoTrack.h:186
agora::rtc::IRemoteVideoTrack::registerMediaPacketReceiver
virtual int registerMediaPacketReceiver(IMediaPacketReceiver *videoReceiver)=0
agora::rtc::LocalVideoTrackStats::capture_brightness_level
CAPTURE_BRIGHTNESS_LEVEL_TYPE capture_brightness_level
Definition: NGIAgoraVideoTrack.h:252
agora::rtc::RemoteVideoTrackStats::totalDecodedFrames
uint32_t totalDecodedFrames
Definition: NGIAgoraVideoTrack.h:417
agora::rtc::LocalVideoTrackStats::ssrc_minor_stream
uint32_t ssrc_minor_stream
Definition: NGIAgoraVideoTrack.h:178
agora::rtc::IRemoteVideoTrack::unregisterMediaPacketReceiver
virtual int unregisterMediaPacketReceiver(IMediaPacketReceiver *videoReceiver)=0
agora::rtc::RemoteVideoTrackStats::delay
int delay
Definition: NGIAgoraVideoTrack.h:367
agora::rtc::ILocalVideoTrack
Definition: NGIAgoraVideoTrack.h:292
agora::rtc::LocalVideoTrackStats::frames_encoded
uint32_t frames_encoded
Definition: NGIAgoraVideoTrack.h:170
agora::rtc::LocalVideoTrackStats::uplink_cost_time_ms
uint32_t uplink_cost_time_ms
Definition: NGIAgoraVideoTrack.h:240
agora::rtc::RemoteVideoTrackStats::RemoteVideoTrackStats
RemoteVideoTrackStats()
Definition: NGIAgoraVideoTrack.h:450
OPTIONAL_OVERRIDE
#define OPTIONAL_OVERRIDE
Definition: NGIAgoraVideoTrack.h:17
agora::rtc::RemoteVideoTrackStats::decoderOutputFrameRate
int decoderOutputFrameRate
Definition: NGIAgoraVideoTrack.h:386
agora::rtc::CAPTURE_BRIGHTNESS_LEVEL_INVALID
@ CAPTURE_BRIGHTNESS_LEVEL_INVALID
Definition: AgoraBase.h:2610
agora::rtc::IMediaPacketReceiver
Definition: NGIAgoraMediaNode.h:581
agora::rtc::IVideoTrack::setFilterProperty
virtual int setFilterProperty(const char *id, const char *key, const char *json_value)
Definition: NGIAgoraVideoTrack.h:134
agora::rtc::VIDEO_STREAM_HIGH
@ VIDEO_STREAM_HIGH
Definition: AgoraBase.h:1537
agora::rtc::IVideoTrack::addRenderer
virtual bool addRenderer(agora_refptr< IVideoSinkBase > videoRenderer, media::base::VIDEO_MODULE_POSITION position=media::base::POSITION_PRE_RENDERER)=0
agora::rtc::IRemoteVideoTrack::getState
virtual REMOTE_VIDEO_STATE getState()=0
agora::rtc::RemoteVideoTrackStats::frame_render_delay_ms
uint32_t frame_render_delay_ms
Definition: NGIAgoraVideoTrack.h:431
agora::rtc::IRemoteVideoTrack::getType
virtual VideoTrackType getType() OPTIONAL_OVERRIDE
Definition: NGIAgoraVideoTrack.h:528
agora::rtc::RemoteVideoTrackStats::frameLossRate
int frameLossRate
Definition: NGIAgoraVideoTrack.h:392
agora::rtc::LocalVideoTrackStats::quality_adapt_indication
QUALITY_ADAPT_INDICATION quality_adapt_indication
Definition: NGIAgoraVideoTrack.h:244
agora::rtc::ILocalVideoTrack::setSimulcastStreamMode
virtual int setSimulcastStreamMode(SIMULCAST_STREAM_MODE mode, const SimulcastStreamConfig &config)=0
agora::rtc::RemoteVideoTrackStats::publishDuration
uint64_t publishDuration
Definition: NGIAgoraVideoTrack.h:440
agora::rtc::IRemoteVideoTrack
Definition: NGIAgoraVideoTrack.h:461
agora::rtc::ILocalVideoTrack::setEnabled
virtual void setEnabled(bool enable)=0
agora::rtc::LocalVideoTrackStats::capture_height
int capture_height
Definition: NGIAgoraVideoTrack.h:218
agora::rtc::VIDEO_STREAM_TYPE
VIDEO_STREAM_TYPE
Definition: AgoraBase.h:1533
agora::rtc::ILocalVideoTrack::getStatistics
virtual bool getStatistics(LocalVideoTrackStats &stats)=0
agora::rtc::RemoteVideoTrackStats::width
int width
Definition: NGIAgoraVideoTrack.h:375
agora::rtc::RemoteVideoTrackStats
Definition: NGIAgoraVideoTrack.h:359
agora::rtc::IRemoteVideoTrack::getStatistics
virtual bool getStatistics(RemoteVideoTrackStats &stats)=0
agora::rtc::LocalVideoTrackStats::encoder_type
uint32_t encoder_type
Definition: NGIAgoraVideoTrack.h:235
agora::rtc::LocalVideoTrackStats::bytes_major_stream
uint64_t bytes_major_stream
Definition: NGIAgoraVideoTrack.h:162
agora::RefCountInterface
Definition: AgoraRefPtr.h:31
agora::rtc::LocalVideoTrackStats::total_bitrate_bps
int total_bitrate_bps
Definition: NGIAgoraVideoTrack.h:210
agora::media::base::POSITION_PRE_RENDERER
@ POSITION_PRE_RENDERER
Definition: AgoraMediaBase.h:985
agora::media::IVideoEncodedFrameObserver
Definition: AgoraMediaBase.h:1361
agora::media::base::POSITION_POST_CAPTURER
@ POSITION_POST_CAPTURER
Definition: AgoraMediaBase.h:984
agora::rtc::IRemoteVideoTrack::unregisterVideoEncodedFrameObserver
virtual int unregisterVideoEncodedFrameObserver(agora::media::IVideoEncodedFrameObserver *encodedObserver)=0
agora::rtc::RemoteVideoTrackStats::packetLossRate
int packetLossRate
Definition: NGIAgoraVideoTrack.h:395
agora::rtc::LocalVideoTrackStats::bytes_minor_stream
uint64_t bytes_minor_stream
Definition: NGIAgoraVideoTrack.h:166
agora::rtc::RemoteVideoTrackStats::avSyncTimeMs
int avSyncTimeMs
Definition: NGIAgoraVideoTrack.h:422
agora::rtc::LocalVideoTrackStats::LocalVideoTrackStats
LocalVideoTrackStats()
Definition: NGIAgoraVideoTrack.h:254
agora::rtc::LocalVideoTrackStats::media_bitrate_bps
int media_bitrate_bps
Definition: NGIAgoraVideoTrack.h:206
agora::rtc::VideoTrackInfo
Definition: AgoraBase.h:3059
agora::rtc::ILocalVideoTrack::setVideoEncoderConfiguration
virtual int setVideoEncoderConfiguration(const VideoEncoderConfiguration &config)=0
agora::rtc::REMOTE_VIDEO_TRACK
@ REMOTE_VIDEO_TRACK
Definition: NGIAgoraVideoTrack.h:30
agora::rtc::LocalVideoTrackStats::height
int height
Definition: NGIAgoraVideoTrack.h:234
agora::rtc::ILocalVideoTrack::getState
virtual LOCAL_VIDEO_STREAM_STATE getState()=0
agora::rtc::RemoteVideoTrackStats::rendererOutputFrameRate
int rendererOutputFrameRate
Definition: NGIAgoraVideoTrack.h:389
agora::rtc::RemoteVideoTrackStats::uid
uid_t uid
Definition: NGIAgoraVideoTrack.h:363
agora::rtc::LOCAL_VIDEO_TRACK
@ LOCAL_VIDEO_TRACK
Definition: NGIAgoraVideoTrack.h:29
agora::rtc::RemoteVideoTrackStats::receivedBitrate
int receivedBitrate
Definition: NGIAgoraVideoTrack.h:383
agora::rtc::LocalVideoTrackStats
Definition: NGIAgoraVideoTrack.h:154