Agora C++ API Reference for All Platforms
audio_node_stat_i.h
1 //
2 // Agora Engine SDK
3 //
4 // Created by ChenZhipeng in 2022-08.
5 // Copyright (c) 2022 Agora.io. All rights reserved.
6 //
7 #pragma once
8 
9 
10 #include <stddef.h>
11 
12 #include <algorithm>
13 #include <cstring>
14 #include <map>
15 #include <string>
16 
17 namespace agora {
18 namespace rtc {
19 
21  UNKNOWN = 0,
22  RECORD = 1 << 0,
23  PUSH_DIRECT = 1 << 1,
24  PUSH_EXTERNAL = 1 << 2,
25  SIMPLE_MEDIA_PLAYER = 1 << 3,
26  FFMPEG_MEDIA_PLAYER = 1 << 4,
27  KNOWN_TYPE_COUNT = 5,
28 };
29 
43  };
44 
45  int64_t time_us[TIMING_COUNT]{};
47 
49 
51  source_type = info.source_type;
52  std::copy(info.time_us, info.time_us + TIMING_COUNT, time_us);
53  }
54 
57  std::copy(rhs.time_us, rhs.time_us + TIMING_COUNT, time_us);
58  return *this;
59  }
60 
61  bool valid() const {
62  return (source_type >= 0 && time_us[FORMAT_FRAME] > 0 &&
64  }
65 
66  static std::string getAudioFrameSourceName(int type) {
67  std::map<int, const char*> source_name = {
68  {static_cast<int>(AUDIO_FRAME_SOURCE_TYPE::UNKNOWN), "unknown"},
69  {static_cast<int>(AUDIO_FRAME_SOURCE_TYPE::RECORD), "record"},
70  {static_cast<int>(AUDIO_FRAME_SOURCE_TYPE::PUSH_DIRECT), "push-direct"},
71  {static_cast<int>(AUDIO_FRAME_SOURCE_TYPE::PUSH_EXTERNAL),
72  "push-external"},
74  "simple_media_player"},
76  "ffmpeg_media_player"},
77  };
78 
79  std::string name;
80  int cnt = static_cast<int>(AUDIO_FRAME_SOURCE_TYPE::KNOWN_TYPE_COUNT);
81  for (int i = 0; i < cnt; ++i) {
82  if (type & (1 << i)) {
83  auto iter = source_name.find(1 << i);
84  if (iter != source_name.end()) {
85  if (!name.empty()) {
86  name.push_back('|');
87  }
88  name.append(iter->second);
89  }
90  }
91  }
92  if (name.empty()) {
93  return "unknown";
94  }
95  return name;
96  }
97 };
98 
99 } // namespace rtc
100 } // namespace agora
agora::rtc::AudioFrameHandleInfo::getAudioFrameSourceName
static std::string getAudioFrameSourceName(int type)
Definition: audio_node_stat_i.h:66
agora::rtc::AudioFrameHandleInfo::AUDIO_UPLINK_HANDLE_TIMING
AUDIO_UPLINK_HANDLE_TIMING
Definition: audio_node_stat_i.h:31
agora::rtc::AudioFrameHandleInfo::POST_TO_ENCODER_QUEUE
@ POST_TO_ENCODER_QUEUE
Definition: audio_node_stat_i.h:35
agora::rtc::AUDIO_FRAME_SOURCE_TYPE::SIMPLE_MEDIA_PLAYER
@ SIMPLE_MEDIA_PLAYER
agora::rtc::AUDIO_FRAME_SOURCE_TYPE::RECORD
@ RECORD
agora::rtc::AudioFrameHandleInfo::ENCODED
@ ENCODED
Definition: audio_node_stat_i.h:38
agora::rtc::AudioFrameHandleInfo::DATA_READY
@ DATA_READY
Definition: audio_node_stat_i.h:33
agora::rtc::AUDIO_FRAME_SOURCE_TYPE::FFMPEG_MEDIA_PLAYER
@ FFMPEG_MEDIA_PLAYER
agora::rtc::AudioFrameHandleInfo::TIMING_COUNT
@ TIMING_COUNT
Definition: audio_node_stat_i.h:42
agora::rtc::AudioFrameHandleInfo::FORMAT_FRAME
@ FORMAT_FRAME
Definition: audio_node_stat_i.h:34
agora::rtc::AudioFrameHandleInfo::source_type
int source_type
Definition: audio_node_stat_i.h:46
agora
Definition: AgoraAtomicOps.h:21
agora::rtc::AUDIO_FRAME_SOURCE_TYPE::KNOWN_TYPE_COUNT
@ KNOWN_TYPE_COUNT
agora::rtc::AudioFrameHandleInfo::AudioFrameHandleInfo
AudioFrameHandleInfo()
Definition: audio_node_stat_i.h:48
agora::rtc::AudioFrameHandleInfo::START_ENCODE
@ START_ENCODE
Definition: audio_node_stat_i.h:37
agora::rtc::AudioFrameHandleInfo::AudioFrameHandleInfo
AudioFrameHandleInfo(const AudioFrameHandleInfo &info)
Definition: audio_node_stat_i.h:50
agora::rtc::AudioFrameHandleInfo
Definition: audio_node_stat_i.h:30
agora::rtc::AudioFrameHandleInfo::READY_SEND
@ READY_SEND
Definition: audio_node_stat_i.h:40
agora::rtc::AudioFrameHandleInfo::POST_TO_SEND_QUEUE
@ POST_TO_SEND_QUEUE
Definition: audio_node_stat_i.h:39
agora::rtc::AUDIO_FRAME_SOURCE_TYPE::PUSH_EXTERNAL
@ PUSH_EXTERNAL
agora::rtc::AudioFrameHandleInfo::valid
bool valid() const
Definition: audio_node_stat_i.h:61
agora::rtc::AudioFrameHandleInfo::time_us
int64_t time_us[TIMING_COUNT]
Definition: audio_node_stat_i.h:45
agora::rtc::AudioFrameHandleInfo::FRAME_PTS
@ FRAME_PTS
Definition: audio_node_stat_i.h:32
agora::rtc::AudioFrameHandleInfo::VOS_SEND
@ VOS_SEND
Definition: audio_node_stat_i.h:41
agora::rtc::AudioFrameHandleInfo::operator=
AudioFrameHandleInfo & operator=(const AudioFrameHandleInfo &rhs)
Definition: audio_node_stat_i.h:55
agora::rtc::AUDIO_FRAME_SOURCE_TYPE
AUDIO_FRAME_SOURCE_TYPE
Definition: audio_node_stat_i.h:20
agora::rtc::AUDIO_FRAME_SOURCE_TYPE::PUSH_DIRECT
@ PUSH_DIRECT
agora::rtc::AudioFrameHandleInfo::PRE_ENCODE
@ PRE_ENCODE
Definition: audio_node_stat_i.h:36
rtc
Definition: video_node_i.h:28
agora::rtc::AUDIO_FRAME_SOURCE_TYPE::UNKNOWN
@ UNKNOWN