From 57c5fb17dbbf52c4b5bc7d6772cf59f4410edb21 Mon Sep 17 00:00:00 2001 From: Heikki Tampio Date: Fri, 19 Jan 2024 09:36:22 +0200 Subject: [PATCH] examples: Update examples to use new create_session API --- examples/binding.cc | 6 ++++-- examples/configuration.cc | 6 ++++-- examples/sync_receiver.cc | 3 ++- examples/sync_sender.cc | 3 ++- examples/v3c_receiver.cc | 3 ++- examples/v3c_sender.cc | 3 ++- examples/zrtp_multistream.cc | 6 ++++-- 7 files changed, 20 insertions(+), 10 deletions(-) diff --git a/examples/binding.cc b/examples/binding.cc index d1a4b80f..cffb457c 100644 --- a/examples/binding.cc +++ b/examples/binding.cc @@ -45,14 +45,16 @@ int main(void) std::cout << "Starting uvgRTP binding example" << std::endl; uvgrtp::context rtp_ctx; - uvgrtp::session *sending_session = rtp_ctx.create_session(LOCAL_INTERFACE, REMOTE_ADDRESS); + std::pair addresses_sender(LOCAL_INTERFACE, REMOTE_ADDRESS); + uvgrtp::session *sending_session = rtp_ctx.create_session(addresses_sender); uvgrtp::media_stream *send = sending_session->create_stream(LOCAL_PORT, REMOTE_PORT, RTP_FORMAT_H265, RCE_NO_FLAGS); /* RCE flags or RTP Context Enable flags are given when creating the Media Stream. Notice the RCE_HOLEPUNCH_KEEPALIVE flag which keeps the NAT/firewall open */ int flags = RCE_HOLEPUNCH_KEEPALIVE; - uvgrtp::session *receiving_session = rtp_ctx.create_session(REMOTE_ADDRESS, LOCAL_INTERFACE); + std::pair addresses_receiver(REMOTE_ADDRESS, LOCAL_INTERFACE); + uvgrtp::session *receiving_session = rtp_ctx.create_session(addresses_receiver); uvgrtp::media_stream *recv = receiving_session->create_stream(REMOTE_PORT, LOCAL_PORT, RTP_FORMAT_H265, flags); diff --git a/examples/configuration.cc b/examples/configuration.cc index 5a6b848b..3e16aec3 100644 --- a/examples/configuration.cc +++ b/examples/configuration.cc @@ -58,10 +58,12 @@ int main(void) RCE_RECEIVE_ONLY; /* interpret address/port as binding interface */ uvgrtp::context ctx; - uvgrtp::session *local_session = ctx.create_session(REMOTE_ADDRESS, LOCAL_ADDRESS); + std::pair addresses_sender(LOCAL_ADDRESS, REMOTE_ADDRESS); + uvgrtp::session *local_session = ctx.create_session(addresses_sender); uvgrtp::media_stream *send = local_session->create_stream(REMOTE_PORT, LOCAL_PORT, RTP_FORMAT_H265, send_flags); - uvgrtp::session *remote_session = ctx.create_session(LOCAL_ADDRESS, REMOTE_ADDRESS); + std::pair addresses_receiver(REMOTE_ADDRESS, LOCAL_ADDRESS); + uvgrtp::session *remote_session = ctx.create_session(addresses_receiver); uvgrtp::media_stream *receive = remote_session->create_stream(LOCAL_PORT, REMOTE_PORT, RTP_FORMAT_H265, receive_flags); if (receive) diff --git a/examples/sync_receiver.cc b/examples/sync_receiver.cc index 3cd4e156..5b335730 100644 --- a/examples/sync_receiver.cc +++ b/examples/sync_receiver.cc @@ -64,7 +64,8 @@ int main(void) std::cout << "Initializing receivers" << std::endl; uvgrtp::context receiver_ctx; - uvgrtp::session* receiver_session = receiver_ctx.create_session(SENDER_ADDRESS, RECEIVER_ADDRESS); + std::pair addresses_receiver(RECEIVER_ADDRESS, SENDER_ADDRESS); + uvgrtp::session* receiver_session = receiver_ctx.create_session(addresses_receiver); // start the audio and video receivers in different threads std::thread a_receiver(receive_function, receiver_session, rce_dh_flags, print_mutex, diff --git a/examples/sync_sender.cc b/examples/sync_sender.cc index 823c2223..18f42e04 100644 --- a/examples/sync_sender.cc +++ b/examples/sync_sender.cc @@ -64,7 +64,8 @@ int main(void) std::cout << "Initializing senders" << std::endl; uvgrtp::context sender_ctx; - uvgrtp::session* sender_session = sender_ctx.create_session(RECEIVER_ADDRESS, SENDER_ADDRESS); + std::pair addresses_sender(SENDER_ADDRESS, RECEIVER_ADDRESS); + uvgrtp::session* sender_session = sender_ctx.create_session(addresses_sender); // start the audio and video in their own threads std::thread a_sender(sender_function, sender_session, rce_dh_flags, print_mutex, diff --git a/examples/v3c_receiver.cc b/examples/v3c_receiver.cc index 3d778aca..d6e731a3 100644 --- a/examples/v3c_receiver.cc +++ b/examples/v3c_receiver.cc @@ -56,7 +56,8 @@ int main(void) /* Initialize uvgRTP context and session*/ uvgrtp::context ctx; - uvgrtp::session* sess = ctx.create_session(LOCAL_IP, LOCAL_IP); + std::pair addresses_receiver(LOCAL_IP, LOCAL_IP); + uvgrtp::session* sess = ctx.create_session(addresses_receiver); int flags = 0; // Create the uvgRTP media streams with the correct RTP format diff --git a/examples/v3c_sender.cc b/examples/v3c_sender.cc index f9566864..4fe988b9 100644 --- a/examples/v3c_sender.cc +++ b/examples/v3c_sender.cc @@ -74,7 +74,8 @@ int main(void) /* Create the necessary uvgRTP media streams */ uvgrtp::context ctx; - uvgrtp::session* sess = ctx.create_session(LOCAL_IP, LOCAL_IP); + std::pair addresses_sender(LOCAL_IP, LOCAL_IP); + uvgrtp::session* sess = ctx.create_session(addresses_sender); int flags = 0; v3c_streams streams = init_v3c_streams(sess, 8892, 8890, flags, false); diff --git a/examples/zrtp_multistream.cc b/examples/zrtp_multistream.cc index b3e10e28..8ca71c33 100644 --- a/examples/zrtp_multistream.cc +++ b/examples/zrtp_multistream.cc @@ -62,7 +62,8 @@ int main(void) } std::cout << "Initializing receivers" << std::endl; - uvgrtp::session *receiver_session = receiver_ctx.create_session(SENDER_ADDRESS, RECEIVER_ADDRESS); + std::pair addresses_receiver(RECEIVER_ADDRESS, SENDER_ADDRESS); + uvgrtp::session *receiver_session = receiver_ctx.create_session(addresses_receiver); std::shared_ptr print_mutex = std::shared_ptr (new std::mutex); @@ -86,7 +87,8 @@ int main(void) std::cout << "Initializing senders" << std::endl; uvgrtp::context sender_ctx; - uvgrtp::session *sender_session = sender_ctx.create_session(RECEIVER_ADDRESS, SENDER_ADDRESS); + std::pair addresses_sender(SENDER_ADDRESS, RECEIVER_ADDRESS); + uvgrtp::session *sender_session = sender_ctx.create_session(addresses_sender); // start the senders in their own threads std::thread a_sender(sender_function, sender_session, rce_dh_flags, print_mutex,