Ignore streaming requests from clients not currently woken up 47/240947/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Thu, 13 Aug 2020 05:14:36 +0000 (14:14 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Thu, 13 Aug 2020 05:14:36 +0000 (14:14 +0900)
Change-Id: I875b53caf10a110c967f6039604fbd4761ea47b7

src/service_main.cpp

index 7830c3f..a741ae0 100644 (file)
@@ -200,6 +200,17 @@ int CServiceMain::client_send_recognition_result(pid_t pid, int result)
 int CServiceMain::client_start_streaming_audio_data(pid_t pid, int type)
 {
        int ret = -1;
+       const char *current_maclient_appid = NULL;
+       if (mCurrentClientInfo >= 0 && mCurrentClientInfo < MAX_MACLIENT_INFO_NUM) {
+               current_maclient_appid = mClientInfo[mCurrentClientInfo].appid;
+               pid_t pid_by_appid = mClientManager.find_client_pid_by_appid(
+                       std::string{current_maclient_appid});
+               if (pid != pid_by_appid) {
+                       MAS_LOGE("[ERROR] Current client: [%d], active client : [%d %s]",
+                               pid, pid_by_appid, current_maclient_appid);
+                       return ret;
+               }
+       }
        switch(type) {
                case MA_AUDIO_STREAMING_DATA_TYPE_CURRENT_UTTERANCE:
                        ret = mServicePlugin.start_streaming_utterance_data();