mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 12:40:19 +00:00
holepunch: Fix building as plugin
This commit is contained in:
13
src/main.cpp
13
src/main.cpp
@@ -1215,13 +1215,22 @@ static int adjust_params(struct ug_options *opt) {
|
||||
punch_c.host_addr = punched_host;
|
||||
punch_c.host_addr_len = sizeof(punched_host);
|
||||
|
||||
if(!punch_udp(punch_c)){
|
||||
auto punch_fcn = reinterpret_cast<bool(*)(Holepunch_config)>(
|
||||
const_cast<void *>(
|
||||
load_library("udp_holepunch", LIBRARY_CLASS_UNDEFINED, HOLEPUNCH_ABI_VERSION)));
|
||||
|
||||
if(!punch_fcn){
|
||||
log_msg(LOG_LEVEL_ERROR, "Failed to load holepunching module\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if(!punch_fcn(punch_c)){
|
||||
log_msg(LOG_LEVEL_ERROR, "Hole punching failed.\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
log_msg(LOG_LEVEL_INFO, "[holepunch] remote: %s\n rx: %d\n tx: %d\n",
|
||||
punched_host, opt->video_rx_port, opt->video_tx_port);
|
||||
punched_host, opt->video_rx_port, opt->video_tx_port);
|
||||
opt->requested_receiver = punched_host;
|
||||
opt->audio.host = punched_host;
|
||||
#endif //HAVE_LIBJUICE
|
||||
|
||||
@@ -35,6 +35,12 @@
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#include "config_unix.h"
|
||||
#include "config_win32.h"
|
||||
#endif
|
||||
|
||||
#include <juice/juice.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
@@ -47,6 +53,7 @@
|
||||
#include "utils/udp_holepunch.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "lib_common.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
@@ -382,3 +389,5 @@ bool punch_udp(struct Holepunch_config c){
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_MODULE(udp_holepunch, punch_udp, LIBRARY_CLASS_UNDEFINED, HOLEPUNCH_ABI_VERSION);
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define HOLEPUNCH_ABI_VERSION 1
|
||||
|
||||
struct Holepunch_config{
|
||||
const char *client_name;
|
||||
const char *room_name;
|
||||
|
||||
Reference in New Issue
Block a user