fusionpbx-install.sh/debian/resources/switch/source/pull_2300.diff

170 lines
7.0 KiB
Diff
Raw Normal View History

2024-06-22 21:28:23 +02:00
diff --git a/src/switch_core_io.c b/src/switch_core_io.c
index 9931f0f3ef7..ee968b63dd9 100644
--- a/src/switch_core_io.c
+++ b/src/switch_core_io.c
@@ -146,13 +146,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
if (session->read_codec && !session->track_id && session->track_duration) {
if (session->read_frame_count == 0) {
switch_event_t *event;
- switch_core_session_message_t msg = { 0 };
+ switch_core_session_message_t *msg = switch_core_session_alloc(session, sizeof(*msg));
session->read_frame_count = (session->read_impl.samples_per_second / session->read_impl.samples_per_packet) * session->track_duration;
- msg.message_id = SWITCH_MESSAGE_HEARTBEAT_EVENT;
- msg.numeric_arg = session->track_duration;
- switch_core_session_receive_message(session, &msg);
+ msg->message_id = SWITCH_MESSAGE_HEARTBEAT_EVENT;
+ msg->numeric_arg = session->track_duration;
+ MESSAGE_STAMP_FFL(msg);
+ switch_core_session_queue_message(session, msg);
+
switch_event_create(&event, SWITCH_EVENT_SESSION_HEARTBEAT);
switch_channel_event_set_data(session->channel, event);
@@ -410,10 +412,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
switch_set_flag(session, SSF_READ_TRANSCODE);
if (!switch_test_flag(session, SSF_WARN_TRANSCODE)) {
- switch_core_session_message_t msg = { 0 };
-
- msg.message_id = SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY;
- switch_core_session_receive_message(session, &msg);
+ switch_core_session_message_t *msg = switch_core_session_alloc(session, sizeof(*msg));
+ msg->message_id = SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY;
+ MESSAGE_STAMP_FFL(msg);
+ switch_core_session_queue_message(session, msg);
switch_set_flag(session, SSF_WARN_TRANSCODE);
}
@@ -562,10 +564,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
status = SWITCH_STATUS_FALSE;
goto done;
} else {
- switch_core_session_message_t msg = { 0 };
- msg.numeric_arg = 1;
- msg.message_id = SWITCH_MESSAGE_RESAMPLE_EVENT;
- switch_core_session_receive_message(session, &msg);
+ switch_core_session_message_t *msg = switch_core_session_alloc(session, sizeof(*msg));
+ msg->message_id = SWITCH_MESSAGE_RESAMPLE_EVENT;
+ msg->numeric_arg = 1;
+ MESSAGE_STAMP_FFL(msg);
+ switch_core_session_queue_message(session, msg);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Activating read resampler\n");
}
@@ -597,10 +600,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
switch_mutex_unlock(session->resample_mutex);
{
- switch_core_session_message_t msg = { 0 };
- msg.numeric_arg = 0;
- msg.message_id = SWITCH_MESSAGE_RESAMPLE_EVENT;
- switch_core_session_receive_message(session, &msg);
+ switch_core_session_message_t *msg = switch_core_session_alloc(session, sizeof(*msg));
+ msg->message_id = SWITCH_MESSAGE_RESAMPLE_EVENT;
+ msg->numeric_arg = 0;
+ MESSAGE_STAMP_FFL(msg);
+ switch_core_session_queue_message(session, msg);
+
}
}
diff --git a/src/switch_core_media.c b/src/switch_core_media.c
index 4b6d8aff8b6..e09242ee0d5 100644
--- a/src/switch_core_media.c
+++ b/src/switch_core_media.c
@@ -15945,12 +15945,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
}
if (!switch_test_flag(session, SSF_WARN_TRANSCODE)) {
- switch_core_session_message_t msg = { 0 };
-
- msg.message_id = SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY;
- switch_core_session_receive_message(session, &msg);
+ switch_core_session_message_t *msg = switch_core_session_alloc(session, sizeof(*msg));
+ msg->message_id = SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY;
+ MESSAGE_STAMP_FFL(msg);
+ switch_core_session_queue_message(session, msg);
switch_set_flag(session, SSF_WARN_TRANSCODE);
- }
+ }
if (frame->codec) {
session->raw_write_frame.datalen = session->raw_write_frame.buflen;
@@ -15993,10 +15993,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
if (status != SWITCH_STATUS_SUCCESS) {
goto done;
} else {
- switch_core_session_message_t msg = { 0 };
- msg.numeric_arg = 1;
- msg.message_id = SWITCH_MESSAGE_RESAMPLE_EVENT;
- switch_core_session_receive_message(session, &msg);
+ switch_core_session_message_t *msg = switch_core_session_alloc(session, sizeof(*msg));
+ msg->message_id = SWITCH_MESSAGE_RESAMPLE_EVENT;
+ msg->numeric_arg = 1;
+ MESSAGE_STAMP_FFL(msg);
+ switch_core_session_queue_message(session, msg);
+
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Activating write resampler\n");
}
@@ -16029,10 +16031,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
switch_mutex_unlock(session->resample_mutex);
{
- switch_core_session_message_t msg = { 0 };
- msg.numeric_arg = 0;
- msg.message_id = SWITCH_MESSAGE_RESAMPLE_EVENT;
- switch_core_session_receive_message(session, &msg);
+ switch_core_session_message_t *msg = switch_core_session_alloc(session, sizeof(*msg));
+ msg->message_id = SWITCH_MESSAGE_RESAMPLE_EVENT;
+ msg->numeric_arg = 0;
+ MESSAGE_STAMP_FFL(msg);
+ switch_core_session_queue_message(session, msg);
}
}
@@ -16329,11 +16332,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
if (status != SWITCH_STATUS_SUCCESS) {
goto done;
} else {
- switch_core_session_message_t msg = { 0 };
- msg.numeric_arg = 1;
- msg.message_id = SWITCH_MESSAGE_RESAMPLE_EVENT;
- switch_core_session_receive_message(session, &msg);
-
+ switch_core_session_message_t *msg = switch_core_session_alloc(session, sizeof(*msg));
+ msg->message_id = SWITCH_MESSAGE_RESAMPLE_EVENT;
+ msg->numeric_arg = 1;
+ MESSAGE_STAMP_FFL(msg);
+ switch_core_session_queue_message(session, msg);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Activating write resampler\n");
}
@@ -16351,7 +16354,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
break;
case SWITCH_STATUS_NOOP:
if (session->write_resampler) {
- switch_core_session_message_t msg = { 0 };
+
int ok = 0;
switch_mutex_lock(session->resample_mutex);
@@ -16363,9 +16366,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
switch_mutex_unlock(session->resample_mutex);
if (ok) {
- msg.numeric_arg = 0;
- msg.message_id = SWITCH_MESSAGE_RESAMPLE_EVENT;
- switch_core_session_receive_message(session, &msg);
+ switch_core_session_message_t *msg = switch_core_session_alloc(session, sizeof(*msg));
+ msg->message_id = SWITCH_MESSAGE_RESAMPLE_EVENT;
+ msg->numeric_arg = 0;
+ MESSAGE_STAMP_FFL(msg);
+ switch_core_session_queue_message(session, msg);
+
}
}