Source

Target

Commits (1)
Showing with 50 additions and 69 deletions
......@@ -390,7 +390,8 @@ static void audio_stream_free(AudioStream *stream) {
static int dtmf_tab[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '*', '#', 'A', 'B', 'C', 'D'};
static void on_dtmf_received(BCTBX_UNUSED(RtpSession *s), uint32_t dtmf, void *user_data) {
static void on_dtmf_received(BCTBX_UNUSED(RtpSession *s), void *dtmf_ptr, void *user_data, BCTBX_UNUSED(void *unused)) {
int dtmf = (uint32_t)(intptr_t)dtmf_ptr;
AudioStream *stream = (AudioStream *)user_data;
if (dtmf > 15) {
ms_warning("Unsupported telephone-event type.");
......@@ -408,9 +409,11 @@ static void on_dtmf_received(BCTBX_UNUSED(RtpSession *s), uint32_t dtmf, void *u
* This is a dirty hack that works anyway.
* It would be interesting to have something that does the job
* more easily within the MSTicker API.
* return TRUE if the decoder was changed, FALSE otherwise.
*/
static bool_t audio_stream_payload_type_changed(RtpSession *session, void *data) {
static void audio_stream_payload_type_changed(RtpSession *session,
void *data,
BCTBX_UNUSED(void *unused1),
BCTBX_UNUSED(void *unused2)) {
AudioStream *stream = (AudioStream *)data;
RtpProfile *prof = rtp_session_get_profile(session);
int payload = rtp_session_get_recv_payload_type(stream->ms.sessions.rtp_session);
......@@ -418,7 +421,7 @@ static bool_t audio_stream_payload_type_changed(RtpSession *session, void *data)
if (stream->ms.decoder == NULL) {
ms_message("audio_stream_payload_type_changed(): no decoder!");
return FALSE;
return;
}
if (pt != NULL) {
......@@ -426,14 +429,14 @@ static bool_t audio_stream_payload_type_changed(RtpSession *session, void *data)
/* if new payload type is Comfort Noise (CN), just do nothing */
if (strcasecmp(pt->mime_type, "CN") == 0) {
ms_message("Ignore payload type change to CN");
return FALSE;
return;
}
if (stream->ms.current_pt && strcasecmp(pt->mime_type, stream->ms.current_pt->mime_type) == 0 &&
pt->clock_rate == stream->ms.current_pt->clock_rate) {
ms_message(
"Ignoring payload type number change because it points to the same payload type as the current one");
return FALSE;
return;
}
// dec = ms_filter_create_decoder(pt->mime_type);
......@@ -456,14 +459,13 @@ static bool_t audio_stream_payload_type_changed(RtpSession *session, void *data)
ms_filter_link(stream->ms.decoder, 0, nextFilter, 0);
ms_filter_preprocess(stream->ms.decoder, stream->ms.sessions.ticker);
stream->ms.current_pt = pt;
return TRUE;
return;
} else {
ms_error("No decoder found for %s", pt->mime_type);
}
} else {
ms_warning("No payload type defined with number %i", payload);
}
return FALSE;
}
/*
......@@ -1324,19 +1326,10 @@ int audio_stream_start_from_io(AudioStream *stream,
stream->dtmfgen = ms_factory_create_filter(stream->ms.factory, MS_DTMF_GEN_ID);
else stream->dtmfgen = NULL;
/* FIXME: Temporary workaround for -Wcast-function-type. */
#if __GNUC__ >= 8
_Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
#endif // if __GNUC__ >= 8
rtp_session_signal_connect(rtps, "telephone-event", (RtpCallback)on_dtmf_received, stream);
rtp_session_signal_connect(rtps, "telephone-event", (RtpCallback)on_dtmf_received, stream);
rtp_session_signal_connect(rtps, "payload_type_changed", (RtpCallback)audio_stream_payload_type_changed, stream);
#if __GNUC__ >= 8
_Pragma("GCC diagnostic pop")
#endif // if __GNUC__ >= 8
if (stream->ms.state == MSStreamPreparing) {
if (stream->ms.state == MSStreamPreparing) {
/*we were using the dummy preload graph, destroy it but keep sound filters unless no soundcard is given*/
_audio_stream_unprepare_sound(stream, io->input.type == MSResourceSoundcard);
}
......@@ -2487,25 +2480,15 @@ void audio_stream_stop(AudioStream *stream) {
}
}
rtp_session_set_rtcp_xr_media_callbacks(stream->ms.sessions.rtp_session, NULL);
/* FIXME: Temporary workaround for -Wcast-function-type. */
#if __GNUC__ >= 8
_Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
#endif // if __GNUC__ >= 8
rtp_session_signal_disconnect_by_callback(stream->ms.sessions.rtp_session, "telephone-event",
(RtpCallback)on_dtmf_received);
rtp_session_signal_disconnect_by_callback(stream->ms.sessions.rtp_session, "telephone-event",
(RtpCallback)on_dtmf_received);
rtp_session_signal_disconnect_by_callback(stream->ms.sessions.rtp_session, "payload_type_changed",
(RtpCallback)audio_stream_payload_type_changed);
#if __GNUC__ >= 8
_Pragma("GCC diagnostic pop")
#endif // if __GNUC__ >= 8
// Before destroying the filters, pump the event queue so that pending events have a chance
// to reach their listeners. When the filter are destroyed, all their pending events in the
// event queue will be cancelled.
evq = ms_factory_get_event_queue(stream->ms.factory);
// Before destroying the filters, pump the event queue so that pending events have a chance
// to reach their listeners. When the filter are destroyed, all their pending events in the
// event queue will be cancelled.
evq = ms_factory_get_event_queue(stream->ms.factory);
if (evq) ms_event_queue_pump(evq);
ms_factory_log_statistics(stream->ms.factory);
audio_stream_free(stream);
......
......@@ -3029,7 +3029,7 @@ static int ice_find_stun_server_request_transaction(IceStunServerRequest *reques
NULL);
}
static int ice_compare_stun_server_requests_to_remove(IceStunServerRequest *request) {
static int ice_compare_stun_server_requests_to_remove(IceStunServerRequest *request, BCTBX_UNUSED(void *unused)) {
return request->to_remove == FALSE;
}
......@@ -4326,7 +4326,7 @@ void ice_session_reset(IceSession *session, IceRole role) {
* GLOBAL PROCESS *
*****************************************************************************/
static int ice_find_gathering_stun_server_request(const IceStunServerRequest *request) {
static int ice_find_gathering_stun_server_request(const IceStunServerRequest *request, BCTBX_UNUSED(void *unused)) {
return request->gathering == FALSE;
}
......
......@@ -161,11 +161,19 @@ void media_stream_remove_goog_remb_handler(MediaStream *stream,
(OrtpEvDispatcherCb)on_goog_remb_received);
}
static void on_ssrc_changed(RtpSession *session) {
static void on_ssrc_changed(RtpSession *session,
BCTBX_UNUSED(void *unused1),
BCTBX_UNUSED(void *unused2),
BCTBX_UNUSED(void *unused3)) {
ms_message("SSRC change detected !");
rtp_session_resync(session);
}
static void rtp_session_resync_cb(RtpSession *session,
BCTBX_UNUSED(void *unused1),
BCTBX_UNUSED(void *unused2),
BCTBX_UNUSED(void *unused3)) {
rtp_session_resync(session);
}
RtpSession *ms_create_duplex_rtp_session(const char *local_ip, int loc_rtp_port, int loc_rtcp_port, int mtu) {
RtpSession *rtpr;
const int socket_buf_size = 2000000;
......@@ -187,7 +195,7 @@ RtpSession *ms_create_duplex_rtp_session(const char *local_ip, int loc_rtp_port,
}
}
rtp_session_signal_connect(rtpr, "timestamp_jump", (RtpCallback)rtp_session_resync, NULL);
rtp_session_signal_connect(rtpr, "timestamp_jump", (RtpCallback)rtp_session_resync_cb, NULL);
rtp_session_signal_connect(rtpr, "ssrc_changed", (RtpCallback)on_ssrc_changed, NULL);
rtp_session_set_ssrc_changed_threshold(rtpr, 0);
......
......@@ -41,7 +41,10 @@ static void text_stream_free(TextStream *stream) {
static void text_stream_process_rtcp(BCTBX_UNUSED(MediaStream *media_stream), BCTBX_UNUSED(const mblk_t *m)) {
}
static void text_stream_payload_type_changed(RtpSession *session, void *data) {
static void text_stream_payload_type_changed(RtpSession *session,
void *data,
BCTBX_UNUSED(void *unused1),
BCTBX_UNUSED(void *unused2)) {
TextStream *stream = (TextStream *)data;
RtpProfile *prof = rtp_session_get_profile(session);
int payload_type = rtp_session_get_recv_payload_type(session);
......@@ -57,7 +60,10 @@ static void text_stream_payload_type_changed(RtpSession *session, void *data) {
}
}
static void text_stream_ssrc_changed(BCTBX_UNUSED(RtpSession *session), void *data) {
static void text_stream_ssrc_changed(BCTBX_UNUSED(RtpSession *session),
void *data,
BCTBX_UNUSED(void *unused1),
BCTBX_UNUSED(void *unused2)) {
TextStream *stream = (TextStream *)data;
ms_warning("SSRC changed on text stream, resync RED/T140 contexts.");
if (!stream->rttsink) {
......
......@@ -997,7 +997,10 @@ static void configure_qrcode_filter(VideoStream *stream) {
}
#endif
static void video_stream_payload_type_changed(RtpSession *session, void *data) {
static void video_stream_payload_type_changed(RtpSession *session,
void *data,
BCTBX_UNUSED(void *unused1),
BCTBX_UNUSED(void *unused2)) {
VideoStream *stream = (VideoStream *)data;
RtpProfile *prof = rtp_session_get_profile(session);
int payload = rtp_session_get_recv_payload_type(session);
......@@ -1368,19 +1371,10 @@ static int video_stream_start_with_source_and_output(VideoStream *stream,
rtp_session_set_jitter_compensation(rtps, jitt_comp);
}
/* FIXME: Temporary workaround for -Wcast-function-type. */
#if __GNUC__ >= 8
_Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
#endif // if __GNUC__ >= 8
rtp_session_signal_connect(stream->ms.sessions.rtp_session, "payload_type_changed",
(RtpCallback)video_stream_payload_type_changed, &stream->ms);
rtp_session_signal_connect(stream->ms.sessions.rtp_session, "payload_type_changed",
(RtpCallback)video_stream_payload_type_changed, &stream->ms);
#if __GNUC__ >= 8
_Pragma("GCC diagnostic pop")
#endif // if __GNUC__ >= 8
rtp_session_get_jitter_buffer_params(stream->ms.sessions.rtp_session, &jbp);
rtp_session_get_jitter_buffer_params(stream->ms.sessions.rtp_session, &jbp);
jbp.max_packets = 1000; // needed for high resolution video
rtp_session_set_jitter_buffer_params(stream->ms.sessions.rtp_session, &jbp);
......@@ -2082,21 +2076,11 @@ static MSFilter *_video_stream_stop(VideoStream *stream, bool_t keep_source) {
}
rtp_session_set_rtcp_xr_media_callbacks(stream->ms.sessions.rtp_session, NULL);
/* FIXME: Temporary workaround for -Wcast-function-type. */
#if __GNUC__ >= 8
_Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
#endif // if __GNUC__ >= 8
rtp_session_signal_disconnect_by_callback(stream->ms.sessions.rtp_session, "payload_type_changed",
(RtpCallback)video_stream_payload_type_changed);
rtp_session_signal_disconnect_by_callback(stream->ms.sessions.rtp_session, "payload_type_changed",
(RtpCallback)video_stream_payload_type_changed);
#if __GNUC__ >= 8
_Pragma("GCC diagnostic pop")
#endif // if __GNUC__ >= 8
/*Automatically the video recorder if it was opened previously*/
if (stream->recorder_output &&
ms_filter_implements_interface(stream->recorder_output, MSFilterRecorderInterface)) {
/*Automatically the video recorder if it was opened previously*/
if (stream->recorder_output && ms_filter_implements_interface(stream->recorder_output, MSFilterRecorderInterface)) {
MSRecorderState state = MSRecorderClosed;
ms_filter_call_method(stream->recorder_output, MS_RECORDER_GET_STATE, &state);
if (state != MSRecorderClosed) {
......