mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
Use user id instead of ice username
This commit is contained in:
@@ -1,45 +1,49 @@
|
||||
#include "x_inner.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "ice_agent.h"
|
||||
#include "log.h"
|
||||
#include "ws_transmission.h"
|
||||
#include "x.h"
|
||||
|
||||
using nlohmann::json;
|
||||
|
||||
static PeerConnection *peer_connection;
|
||||
|
||||
PeerPtr *CreatePeer(const Params *params) {
|
||||
PeerPtr *peer_ptr = new PeerPtr;
|
||||
peer_ptr->peer_connection = new PeerConnection();
|
||||
peer_ptr->pc_params.cfg_path = params->cfg_path;
|
||||
peer_ptr->pc_params.on_receive_buffer = params->on_receive_buffer;
|
||||
peer_ptr->pc_params.net_status_report = params->net_status_report;
|
||||
|
||||
return peer_ptr;
|
||||
}
|
||||
|
||||
int CreateConnection(PeerPtr *peer_ptr) {
|
||||
peer_ptr->peer_connection->Create(peer_ptr->pc_params);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CreateConnection(PeerPtr *peer_ptr, const char *connection_id) {
|
||||
peer_ptr->peer_connection->Create(peer_ptr->pc_params, connection_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int JoinConnection(PeerPtr *peer_ptr, const char *connection_id) {
|
||||
peer_ptr->peer_connection->Join(peer_ptr->pc_params, connection_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SendData(PeerPtr *peer_ptr, const char *data, size_t size) {
|
||||
peer_ptr->peer_connection->SendData(data, size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "x_inner.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "ice_agent.h"
|
||||
#include "log.h"
|
||||
#include "ws_transmission.h"
|
||||
#include "x.h"
|
||||
|
||||
using nlohmann::json;
|
||||
|
||||
static PeerConnection *peer_connection;
|
||||
|
||||
PeerPtr *CreatePeer(const Params *params) {
|
||||
PeerPtr *peer_ptr = new PeerPtr;
|
||||
peer_ptr->peer_connection = new PeerConnection();
|
||||
peer_ptr->pc_params.cfg_path = params->cfg_path;
|
||||
peer_ptr->pc_params.on_receive_buffer = params->on_receive_buffer;
|
||||
peer_ptr->pc_params.net_status_report = params->net_status_report;
|
||||
|
||||
return peer_ptr;
|
||||
}
|
||||
|
||||
int CreateConnection(PeerPtr *peer_ptr) {
|
||||
peer_ptr->peer_connection->Create(peer_ptr->pc_params);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CreateConnection(PeerPtr *peer_ptr, const char *transmission_id,
|
||||
const char *user_id) {
|
||||
peer_ptr->peer_connection->Create(peer_ptr->pc_params, transmission_id,
|
||||
user_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int JoinConnection(PeerPtr *peer_ptr, const char *transmission_id,
|
||||
const char *user_id) {
|
||||
peer_ptr->peer_connection->Join(peer_ptr->pc_params, transmission_id,
|
||||
user_id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SendData(PeerPtr *peer_ptr, const char *data, size_t size) {
|
||||
peer_ptr->peer_connection->SendData(data, size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rtc() { return 0; }
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef _X_INNER_H_
|
||||
#define _X_INNER_H_
|
||||
|
||||
#include "peer_connection.h"
|
||||
|
||||
struct Peer {
|
||||
PeerConnection *peer_connection;
|
||||
PeerConnectionParams pc_params;
|
||||
};
|
||||
|
||||
#ifndef _X_INNER_H_
|
||||
#define _X_INNER_H_
|
||||
|
||||
#include "peer_connection.h"
|
||||
|
||||
struct Peer {
|
||||
PeerConnection *peer_connection;
|
||||
PeerConnectionParams pc_params;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user