Emit START event forcibly if CONTINUE is received without START 71/266971/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Tue, 23 Nov 2021 07:42:46 +0000 (16:42 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Tue, 23 Nov 2021 07:42:52 +0000 (16:42 +0900)
Change-Id: I428a2627e08db5deb276135d58e0c2745c3da3ce

client/ma_ap_dbus.c
client/ma_dbus.c

index 0cc8e03ad6c492277b0384e38087c373acd7d401..c25d62a035d2e356999ff729f2bdd4ef35bbd601 100644 (file)
@@ -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) {
index ff58316d83a901a45ed155a6d3ab59e9e8f4a422..a67a2adcf49900600c56600a90286feb09ced731 100644 (file)
@@ -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) {