代码拉取完成,页面将自动刷新
同步操作将从 ubonass/janus-gateway-patch 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
diff --git a/plugins/janus_audiobridge.c b/plugins/janus_audiobridge.c
old mode 100644
new mode 100755
index 92324d34..12ba0fb5
--- a/plugins/janus_audiobridge.c
+++ b/plugins/janus_audiobridge.c
@@ -2319,6 +2319,40 @@ static void janus_audiobridge_notify_participants(janus_audiobridge_participant
}
}
+//add by jeffrey
+typedef struct audio_level audio_level_t;
+struct audio_level {
+ gchar user_id[128];
+ //gchar room_id[128];
+ gboolean talking;
+ int dBov_level;
+};
+
+static void janus_audiobridge_audio_level_notify_participants(
+ janus_audiobridge_participant *participant, audio_level_t *audio_level)
+{
+ /* participant->room->participants_mutex has to be locked. */
+ GHashTableIter iter;
+ gpointer value;
+ g_hash_table_iter_init(&iter, participant->room->participants);
+
+ while(!participant->room->destroyed && g_hash_table_iter_next(&iter, NULL, &value)) {
+ janus_audiobridge_participant *p = value;
+ if(p && p->session && p != participant) {
+ JANUS_LOG(LOG_VERB, "Notifying participant %s (%s)\n", p->user_id_str, p->display ? p->display : "??");
+ //int ret = gateway->push_event(p->session->handle, &janus_audiobridge_plugin, NULL, msg, NULL);
+ /* Forward the packet to the peer */
+ janus_plugin_data r = {
+ .label = NULL,
+ .binary = TRUE,
+ .buffer = (char*)audio_level,
+ .length = sizeof(audio_level_t)
+ };
+ gateway->relay_data(p->session->handle, &r);
+ }
+ }
+}
+
json_t *janus_audiobridge_query_session(janus_plugin_session *handle) {
if(g_atomic_int_get(&stopping) || !g_atomic_int_get(&initialized)) {
return NULL;
@@ -4605,6 +4639,10 @@ void janus_audiobridge_incoming_rtp(janus_plugin_session *handle, janus_plugin_r
participant->audio_dBov_sum += level;
participant->audio_active_packets++;
participant->dBov_level = level;
+
+ //JANUS_LOG(LOG_ERR, "user_id_str = %s, participant->dBov_level = %d\n",
+ // participant->user_id_str,participant->dBov_level);
+
if(participant->audio_active_packets > 0 && participant->audio_active_packets == audio_active_packets) {
gboolean notify_talk_event = FALSE;
if((float) participant->audio_dBov_sum / (float) participant->audio_active_packets < audio_level_average) {
@@ -4620,8 +4658,10 @@ void janus_audiobridge_incoming_rtp(janus_plugin_session *handle, janus_plugin_r
}
participant->audio_active_packets = 0;
participant->audio_dBov_sum = 0;
+
/* Only notify in case of state changes */
if(participant->room && notify_talk_event) {
+ #if 0
janus_mutex_lock(&participant->room->mutex);
json_t *event = json_object();
json_object_set_new(event, "audiobridge", json_string(participant->talking ? "talking" : "stopped-talking"));
@@ -4644,6 +4684,19 @@ void janus_audiobridge_incoming_rtp(janus_plugin_session *handle, janus_plugin_r
string_ids ? json_string(participant->user_id_str) : json_integer(participant->user_id));
gateway->notify_event(&janus_audiobridge_plugin, session->handle, info);
}
+ #else
+ //add by jeffrey
+ janus_mutex_lock(&participant->room->mutex);
+ audio_level_t audio_level_info;
+ audio_level_info.dBov_level = participant->dBov_level;
+ audio_level_info.talking = participant->talking;
+ memcpy(audio_level_info.user_id, participant->user_id_str,strlen(participant->user_id_str));
+ audio_level_info.user_id[strlen(participant->user_id_str)] = '\n';
+ //memcpy(audio_level_info.room_id, participant->room->room_id_str,strlen(participant->room->room_id_str));
+ //audio_level_info.room_id[strlen(participant->room->room_id_str)] = '\n';
+ janus_mutex_unlock(&participant->room->mutex);
+ janus_audiobridge_audio_level_notify_participants(participant,&audio_level_info);
+ #endif
}
}
}
@@ -6104,7 +6157,7 @@ static void *janus_audiobridge_handler(void *data) {
/* Reject video and data channels, if offered */
JANUS_SDP_OA_AUDIO_CODEC, janus_audiocodec_name(participant->codec),
JANUS_SDP_OA_VIDEO, FALSE,
- JANUS_SDP_OA_DATA, FALSE,
+ JANUS_SDP_OA_DATA, TRUE,//modify by jeffrey
JANUS_SDP_OA_ACCEPT_EXTMAP, JANUS_RTP_EXTMAP_MID,
JANUS_SDP_OA_ACCEPT_EXTMAP, JANUS_RTP_EXTMAP_AUDIO_LEVEL,
JANUS_SDP_OA_DONE);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。