6565#include " transmit.h"
6666#include " types.h" // for tx_media_type
6767#include " utils/audio_buffer.h"
68+ #include " utils/macros.h" // for STR_LEN
69+ #include " utils/net.h" // for get_sockaddr_addr_str
6870#include " utils/thread.h"
6971
72+ #define MOD_NAME " [audio mixer] "
73+
7074#define SAMPLE_RATE 48000
7175#define BPS 2 // / @todo 4?
7276#define CHANNELS 1
@@ -122,7 +126,10 @@ static void mixer_dummy_rtp_callback(struct rtp *session [[gnu::unused]], rtp_ev
122126}
123127
124128struct am_participant {
125- am_participant (struct socket_udp_local *l, struct sockaddr_storage *ss, string const & audio_codec) {
129+ am_participant (struct socket_udp_local *l, struct sockaddr_storage *ss,
130+ string const &audio_codec)
131+ : remote_addr(*ss)
132+ {
126133 assert (l != nullptr && ss != nullptr );
127134 m_buffer = audio_buffer_init (SAMPLE_RATE, BPS, CHANNELS, get_commandline_param (" low-latency-audio" ) ? 50 : 5 );
128135 assert (m_buffer != NULL );
@@ -140,6 +147,12 @@ struct am_participant {
140147 LOG (LOG_LEVEL_ERROR) << " Audio coder init failed!\n " ;
141148 throw 1 ;
142149 }
150+
151+ char buf[STR_LEN];
152+ MSG (NOTICE, " added participant: %s:%u\n " ,
153+ get_sockaddr_addr_str ((struct sockaddr *) &ss, buf,
154+ sizeof buf),
155+ get_sockaddr_addr_port ((struct sockaddr *) &ss));
143156 }
144157 ~am_participant () {
145158 if (m_tx_session) {
@@ -154,6 +167,11 @@ struct am_participant {
154167 if (m_audio_coder) {
155168 audio_codec_done (m_audio_coder);
156169 }
170+ char buf[STR_LEN];
171+ MSG (NOTICE, " removed participant: %s:%u\n " ,
172+ get_sockaddr_addr_str ((struct sockaddr *) &remote_addr, buf,
173+ sizeof buf),
174+ get_sockaddr_addr_port ((struct sockaddr *) &remote_addr));
157175 }
158176 am_participant& operator =(am_participant&& other) {
159177 m_audio_coder = std::move (other.m_audio_coder );
@@ -170,6 +188,7 @@ struct am_participant {
170188 am_participant (am_participant && other) {
171189 *this = std::move (other);
172190 }
191+ struct sockaddr_storage remote_addr;
173192 struct audio_codec_state *m_audio_coder;
174193 struct audio_buffer *m_buffer;
175194 struct rtp *m_network_device;
0 commit comments