Agora Java API Reference for Android
agora_service_i.h
1 //
2 // Agora Media SDK
3 //
4 // Created by Sting Feng in 2015-05.
5 // Copyright (c) 2015 Agora IO. All rights reserved.
6 //
7 #pragma once
8 
9 #include <memory>
10 #include <string>
11 
12 #include "AgoraRefPtr.h"
13 
14 #include "IAgoraService.h"
15 #include "IAgoraLog.h"
16 
17 #include "audio_options_i.h"
18 #include "bitrate_constraints.h"
19 
20 #include <functional>
21 #include <string>
22 
23 struct event_base;
24 
25 namespace agora {
26 namespace rtc {
27 class AgoraGenericBridge;
28 class ConfigService;
29 class IDiagnosticService;
30 class ILocalUserEx;
31 class PredefineIpList;
32 class IRtcConnection;
33 struct RtcConnectionConfigurationEx;
34 class IMediaExtensionObserver;
35 class XdumpHandler;
36 } // namespace rtc
37 
38 namespace utils {
39 struct AudioSessionParam;
40 template<class T> class RtcAsyncCallback;
41 } // namespace utils
42 
43 namespace commons {
44 namespace cjson {
45 class JsonWrapper;
46 } // namespace cjson
47 } // namespace commons
48 
49 typedef agora::commons::cjson::JsonWrapper any_document_t;
50 
51 namespace base {
52 class IAgoraServiceObserver;
53 
54 enum MediaEngineType {
58  MEDIA_ENGINE_WEBRTC,
62  MEDIA_ENGINE_EMPTY,
66  MEDIA_ENGINE_UNKNOWN
67 };
68 
70  MediaEngineType engineType = MEDIA_ENGINE_WEBRTC;
71  const char* deviceId = nullptr;
72  const char* deviceInfo = nullptr;
73  const char* systemInfo = nullptr;
74  const char* configDir = nullptr;
75  const char* dataDir = nullptr;
76  const char* pluginDir = nullptr;
77  rtc::BitrateConstraints bitrateConstraints;
78 
80  bitrateConstraints.start_bitrate_bps = kDefaultStartBitrateBps;
81  bitrateConstraints.max_bitrate_bps = kDefaultMaxBitrateBps;
82  }
83 
86  bitrateConstraints.max_bitrate_bps = kDefaultMaxBitrateBps;
87  bitrateConstraints.start_bitrate_bps = kDefaultStartBitrateBps;
88  }
89 
90  private:
91  static constexpr int kDefaultMaxBitrateBps = (24 * 10 * 1000 * 95);
92  static constexpr int kDefaultStartBitrateBps = 300000;
93 };
94 
95 class BaseContext;
96 
97 // full feature definition of rtc engine interface
99  public:
100  static const char* getSourceVersion();
101  virtual int initializeEx(const AgoraServiceConfigEx& context) = 0;
102  virtual agora_refptr<rtc::IRtcConnection> createRtcConnectionEx(
103  const rtc::RtcConnectionConfigurationEx& cfg) = 0;
104  // Only added for RtcEngine compatibility.
105  virtual int panic(void* exception) = 0;
106  // Returns a libevent event_base created by event_base_new. Also this implies
107  // the application might use this event as its main event loop.
108  virtual event_base* getWorkerEventBase() = 0;
109  virtual agora::rtc::AgoraGenericBridge* getBridge() = 0;
110  virtual BaseContext& getBaseContext() = 0;
111  virtual void setBaseContext(BaseContext* context) = 0;
112 
113  virtual int32_t setLogWriter(agora::commons::ILogWriter* logWriter) = 0;
114  virtual agora::commons::ILogWriter* releaseLogWriter() = 0;
115 
116  virtual rtc::ConfigService* getConfigService() = 0;
117 
118  virtual agora_refptr<rtc::IRtcConnection> getOneRtcConnection(bool admBinded) const = 0;
119 
120  virtual const std::string& getAppId() const = 0;
121 
122  virtual agora_refptr<rtc::PredefineIpList> getPredefineIpList() const = 0;
123 
124  virtual void enableStringUid(bool enabled) = 0;
125  virtual bool useStringUid() const = 0;
126  virtual rtc::uid_t getUidByUserAccount(const std::string& user_account) const = 0;
127 
128  // Register string user account before join channel, this would speed up join channel time.
129  virtual void registerLocalUserAccount(const char* appId, const char* userAccount) = 0;
130 
131  virtual rtc::IDiagnosticService *getDiagnosticService() const = 0;
132 
133  virtual int registerAgoraServiceObserver(IAgoraServiceObserver* observer) = 0;
134  virtual int unregisterAgoraServiceObserver(IAgoraServiceObserver* observer) = 0;
135 
136  virtual std::shared_ptr<utils::RtcAsyncCallback<rtc::IMediaExtensionObserver>> getExtensionCallback() const = 0;
137  virtual rtc::XdumpHandler* getXdumpHandler() const = 0;
138  virtual const std::string& getServiceId() const = 0;
139  protected:
140  virtual ~IAgoraServiceEx() {}
141 };
142 
144  public:
145  virtual ~IAgoraServiceObserver() = default;
146 
147  virtual void onLocalUserRegistered(rtc::uid_t uid, const char* userAccount) = 0;
148 };
149 
150 } // namespace base
151 } // namespace agora
agora::base::IAgoraServiceObserver
Definition: agora_service_i.h:143
agora::base::IAgoraService
Definition: IAgoraService.h:418
agora::commons::ILogWriter
Definition: IAgoraLog.h:50
agora::agora_refptr
Definition: AgoraRefPtr.h:44
agora::base::AgoraServiceConfiguration
Definition: IAgoraService.h:80
agora::base::AgoraServiceConfigEx
Definition: agora_service_i.h:69
agora::rtc::RtcConnectionConfigurationEx
Definition: rtc_connection_i.h:92
agora::rtc::IDiagnosticService
Definition: diagnostic_service_i.h:35
agora::base::IAgoraServiceEx
Definition: agora_service_i.h:98
agora::utils::RtcAsyncCallback
Definition: agora_service_i.h:40
agora::rtc::BitrateConstraints
Definition: bitrate_constraints.h:20