From 71cb6e63f838ddf59dc5bb5455465f23beafb46d Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 23 Nov 2021 16:42:46 +0900 Subject: [PATCH] Emit START event forcibly if CONTINUE is received without START Change-Id: I428a2627e08db5deb276135d58e0c2745c3da3ce --- client/ma_ap_dbus.c | 15 +++++++++++++-- client/ma_dbus.c | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/client/ma_ap_dbus.c b/client/ma_ap_dbus.c index 0cc8e03..c25d62a 100644 --- a/client/ma_ap_dbus.c +++ b/client/ma_ap_dbus.c @@ -91,6 +91,16 @@ static void message_port_cb(int local_port_id, memcpy(&audio_data_header, pending_buffer + sizeof(streaming_data_header), sizeof(streaming_data_audio_data_header)); + static bool start_received = false; + if (audio_data_header.event == MA_AUDIO_STREAMING_EVENT_CONTINUE && !start_received) { + MA_SLOGE("[ERROR] CONTINUE without START, forcing to emit START event"); + audio_data_header.event = MA_AUDIO_STREAMING_EVENT_START; + } + + if (audio_data_header.event == MA_AUDIO_STREAMING_EVENT_START) start_received = true; + /* Reset if FINISHED received */ + if (audio_data_header.event == MA_AUDIO_STREAMING_EVENT_FINISH) start_received = false; + /* Don't invoke audio streaming callback for CONTINUE audio events if the streaming request is no more valid, since it would not provide any useful information to the client application */ @@ -98,8 +108,9 @@ static void message_port_cb(int local_port_id, __ma_ap_cb_audio_streaming(audio_data_header.event, pending_buffer + sizeof(streaming_data_header) + sizeof(streaming_data_audio_data_header), audio_data_header.data_size); - if (0 == header.streaming_data_serial % 50 || MA_AUDIO_STREAMING_EVENT_FINISH == audio_data_header.event) { - MA_SLOGE("__ma_ap_cb_audio_streaming() called, serial : %d", header.streaming_data_serial); + if (0 == header.streaming_data_serial % 50 || MA_AUDIO_STREAMING_EVENT_CONTINUE != audio_data_header.event) { + MA_SLOGE("__ma_ap_cb_audio_streaming() called, event and serial : %d %d", + audio_data_header.event, header.streaming_data_serial); } } } else if (streaming_data_type_streaming_section == header.streaming_data_type) { diff --git a/client/ma_dbus.c b/client/ma_dbus.c index ff58316..a67a2ad 100644 --- a/client/ma_dbus.c +++ b/client/ma_dbus.c @@ -106,6 +106,16 @@ static void message_port_cb(int local_port_id, memcpy(&audio_data_header, pending_buffer + sizeof(streaming_data_header), sizeof(streaming_data_audio_data_header)); + static bool start_received = false; + if (audio_data_header.event == MA_AUDIO_STREAMING_EVENT_CONTINUE && !start_received) { + MA_SLOGE("[ERROR] CONTINUE without START, forcing to emit START event"); + audio_data_header.event = MA_AUDIO_STREAMING_EVENT_START; + } + + if (audio_data_header.event == MA_AUDIO_STREAMING_EVENT_START) start_received = true; + /* Reset if FINISHED received */ + if (audio_data_header.event == MA_AUDIO_STREAMING_EVENT_FINISH) start_received = false; + /* Don't invoke audio streaming callback for CONTINUE audio events if the streaming request is no more valid, since it would not provide any useful information to the client application */ @@ -113,8 +123,9 @@ static void message_port_cb(int local_port_id, __ma_cb_audio_streaming(audio_data_header.event, pending_buffer + sizeof(streaming_data_header) + sizeof(streaming_data_audio_data_header), audio_data_header.data_size); - if (0 == header.streaming_data_serial % 50 || MA_AUDIO_STREAMING_EVENT_FINISH == audio_data_header.event) { - MA_SLOGE("__ma_cb_audio_streaming() called, serial : %d", header.streaming_data_serial); //LCOV_EXCL_LINE + if (0 == header.streaming_data_serial % 50 || MA_AUDIO_STREAMING_EVENT_CONTINUE != audio_data_header.event) { + MA_SLOGE("__ma_ap_cb_audio_streaming() called, event and serial : %d %d", + audio_data_header.event, header.streaming_data_serial); } } } else if (streaming_data_type_streaming_section == header.streaming_data_type) { -- 2.34.1