if (type == MUSE_PLAYER_EVENT_TYPE_BUFFERING) {
if (!_player_check_network_availability())
return PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE;
+ pc->cb_info->drop_buffering_message = FALSE;
}
if (!CALLBACK_INFO(pc))
int percent;
muse_player_event_e ev = MUSE_PLAYER_EVENT_TYPE_BUFFERING;
- if (player_msg_get(percent, recv_data->buffer))
+ if (player_msg_get(percent, recv_data->buffer)) {
+ g_mutex_lock(&cb_info->buffering_cb_mutex);
+ if (cb_info->drop_buffering_message) {
+ LOGD("Drop buffering callback");
+ g_mutex_unlock(&cb_info->buffering_cb_mutex);
+ return;
+ }
+ g_mutex_unlock(&cb_info->buffering_cb_mutex);
((player_buffering_cb)cb_info->user_cb[ev])(percent, cb_info->user_data[ev]);
+ }
+
}
static void __subtitle_cb_handler(callback_cb_info_s *cb_info, _player_recv_data *recv_data)
break;
}
g_mutex_unlock(&cb_info->seek_cb_mutex);
+ } else if (event_type == MUSE_PLAYER_EVENT_TYPE_BUFFERING) {
+ g_mutex_lock(&cb_info->buffering_cb_mutex);
+ if (cb_info->drop_buffering_message) {
+ LOGD("Drop buffering event");
+ g_mutex_unlock(&cb_info->buffering_cb_mutex);
+ break;
+ }
+ g_mutex_unlock(&cb_info->buffering_cb_mutex);
}
if (_player_need_sync_context(event_type)) {
g_mutex_init(&cb_info->data_mutex);
g_mutex_init(&cb_info->seek_cb_mutex);
+ g_mutex_init(&cb_info->buffering_cb_mutex);
+ cb_info->drop_buffering_message = FALSE;
buff = &cb_info->buff;
buff->recvMsg = g_new(char, MUSE_MSG_MAX_LENGTH + 1);
g_mutex_clear(&cb_info->data_mutex);
g_mutex_clear(&cb_info->seek_cb_mutex);
+ g_mutex_clear(&cb_info->buffering_cb_mutex);
g_free(cb_info->buff.recvMsg);
_remove_all_ret_msg(cb_info);
}
}
#endif
+ g_mutex_lock(&pc->cb_info->buffering_cb_mutex);
+ pc->cb_info->drop_buffering_message = TRUE;
+ g_mutex_unlock(&pc->cb_info->buffering_cb_mutex);
+
+ _player_remove_idle_event(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_BUFFERING, false);
PLAYER_SEND_MSG(api, pc, ret_buf, ret);
+ g_mutex_lock(&pc->cb_info->buffering_cb_mutex);
+ pc->cb_info->drop_buffering_message = FALSE;
+ g_mutex_unlock(&pc->cb_info->buffering_cb_mutex);
+
g_free(ret_buf);
LOGD("LEAVE 0x%X", ret);