[0.3.85] fix the coverity issues 26/172526/1 accepted/tizen/unified/20180316.062625 submit/tizen/20180315.045512
authorEunhae Choi <eunhae1.choi@samsung.com>
Wed, 14 Mar 2018 08:40:28 +0000 (17:40 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Wed, 14 Mar 2018 08:40:28 +0000 (17:40 +0900)
Change-Id: Ic7d18597cdfebc24aab903051a47ebd864f0bed2

include/player_msg.h
packaging/capi-media-player.spec
src/player.c
test/player_audio_test.c
test/player_es_push_test.c
test/player_test.c

index 81abec9a6e454de0cefc13d6670e1cdd45e7a6d3..ace8536f93fb00eccfeda074dfcb300cf4467faf 100644 (file)
@@ -677,8 +677,9 @@ do {        \
  * @param[in] param1 the name of param is key, must be local variable. never be pointer.
  * @param[in] type2 The enum of parameter type. Muse be one of thease(INT, INT64, POINTER, DOUBLE, STRING, ARRAY)
  * @param[in] param2 the name of param is key, must be local variable. never be pointer.
+ * @param[out] ret set ERROR when fail to send msg.
  */
-#define player_msg_create_handle(api, fd, type1, param1, type2, param2) \
+#define player_msg_create_handle(api, fd, type1, param1, type2, param2, ret) \
        do {    \
                char *__sndMsg__; \
                int __len__; \
@@ -692,7 +693,7 @@ do {        \
                muse_core_msg_free(__sndMsg__); \
                if (__len__ <= 0) { \
                        LOGE("sending message failed"); \
-                       return PLAYER_ERROR_INVALID_OPERATION; \
+                       ret = PLAYER_ERROR_INVALID_OPERATION; \
                } \
        } while (0)
 
index 4eab1c347faec723f9bbf3cf38d162620f848f8c..4a78547a7f7ae828498add27ca4c33fe445b1930 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-player
 Summary:    A Media Player API
-Version:    0.3.84
+Version:    0.3.85
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 32910cb65349bf25286facab3e75d196100d1216..028a12dd91d3722a70a42434ea780c0dcff52198 100644 (file)
@@ -1737,7 +1737,9 @@ int player_create(player_h * player)
                        goto ERROR;
                }
 
-               player_msg_create_handle(api, sock_fd, INT, module, INT, pid);
+               player_msg_create_handle(api, sock_fd, INT, module, INT, pid, ret);
+               if (ret == PLAYER_ERROR_INVALID_OPERATION)
+                       goto ERROR;
 
                pc->cb_info = callback_new(sock_fd);
                if (!pc->cb_info) {
@@ -4035,7 +4037,10 @@ int player_push_media_stream(player_h player, media_packet_h packet)
 #endif
        if (push_media.buf_type == PUSH_MEDIA_BUF_TYPE_RAW) {
                buf_size = (int)push_media.size;
-               muse_client_ipc_push_data(pc->cb_info->data_fd, buf, buf_size, push_media.pts);
+               if (muse_client_ipc_push_data(pc->cb_info->data_fd, buf, buf_size, push_media.pts) < 0) {
+                       LOGE("failed to send data");
+                       return PLAYER_ERROR_INVALID_OPERATION;
+               }
                player_msg_send_array(api, pc, ret_buf, ret, push_media_msg, msg_size, sizeof(char));
        }
 
index 8ed65b6823c4b7f667a1e159064f8379bc9b8a46..ac8493a067866efd067cf5b039252d05628add5b 100644 (file)
@@ -357,7 +357,11 @@ static void buffer_need_audio_data_cb(unsigned int size, void *user_data)
                media_packet_destroy(g_audio_pkt);
                g_audio_pkt = NULL;
        }
-       media_packet_create_alloc(g_audio_fmt, NULL, NULL, &g_audio_pkt);
+
+       if (media_packet_create_alloc(g_audio_fmt, NULL, NULL, &g_audio_pkt) != MEDIA_PACKET_ERROR_NONE) {
+               g_print("media_packet_create_alloc failed\n");
+               goto EXIT;
+       }
 
        g_print("packet = %p, src = %p\n", g_audio_pkt, src);
 
index 4d4091871c830fc8991bc1c5bd19f7f01de45902..f51d313f996103b9bd54fc7c133edd344e0f2361 100644 (file)
@@ -326,7 +326,10 @@ int bytestream2nalunit(FILE * fd, unsigned char *nal)
                }
        }
 
-       fseek(fd, -(zero_count + 1), SEEK_CUR);
+       if (fseek(fd, -(zero_count + 1), SEEK_CUR) < 0) {
+               LOGE("failed fseek");
+               return -1;
+       }
 
        if (nal_unit_type == 0x7) {
                sps_len = nal_length;
index 326f75abd7998261c60fc5752245474a0564a5f7..3826f60e1fd5d0583255f07b857381456c49dc35 100644 (file)
@@ -860,7 +860,10 @@ static void buffer_need_video_data_cb(unsigned int size, void *user_data)
                g_video_pkt = NULL;
        }
 
-       media_packet_create_alloc(g_video_fmt, NULL, NULL, &g_video_pkt);
+       if (media_packet_create_alloc(g_video_fmt, NULL, NULL, &g_video_pkt) != MEDIA_PACKET_ERROR_NONE) {
+               g_print("media_packet_create_alloc failed\n");
+               goto EXIT;
+       }
 
        g_print("packet = %p, src = %p\n", g_video_pkt, src);
 
@@ -934,7 +937,11 @@ static void buffer_need_audio_data_cb(unsigned int size, void *user_data)
                media_packet_destroy(g_audio_pkt);
                g_audio_pkt = NULL;
        }
-       media_packet_create_alloc(g_audio_fmt, NULL, NULL, &g_audio_pkt);
+
+       if (media_packet_create_alloc(g_audio_fmt, NULL, NULL, &g_audio_pkt) != MEDIA_PACKET_ERROR_NONE) {
+               g_print("media_packet_create_alloc failed\n");
+               goto EXIT;
+       }
 
        g_print("packet = %p, src = %p\n", g_audio_pkt, src);