media_packet_pool: Revise media_packet_pool_set_media_format() 46/256146/2 submit/tizen/20210330.080445
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 30 Mar 2021 05:46:41 +0000 (14:46 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 30 Mar 2021 06:13:16 +0000 (15:13 +0900)
Revise condition to validate format type. The commit
1fbba30197cb2a0a28a740ea3ed06a795a593ffc affects the previous
condition, therefore it is fixed now.

Fix invalid return value according to API description.

[Version] 0.1.44
[Issue Type] Bug fix

Change-Id: I898a3f56d6a4c7de2a87ef882ae18bbf2d6cdcc1
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/capi-media-tool.spec
src/media_packet_pool.c

index a1d855671b55bc00bcd605ea6bebba2680ece6c3..56268568c7398e4c2645e3bb78de23191285389b 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-tool
 Summary:    A Core API media tool library in Tizen Native API
-Version:    0.1.43
+Version:    0.1.44
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 76514b97b6710acdf989aa9f12ebb01ef17ed9c7..01ce6f2571f88b4aa5aae2115754490ee9e98ede 100644 (file)
@@ -65,13 +65,16 @@ int media_packet_pool_set_media_format(media_packet_pool_h pool, media_format_h
        MEDIA_PACKET_POOL_NULL_ARG_CHECK(fmt);
 
        ret = media_format_get_type(fmt, &type);
-       if (ret == MEDIA_FORMAT_ERROR_INVALID_OPERATION || type == MEDIA_FORMAT_CONTAINER || type == MEDIA_FORMAT_TEXT) {
-               LOGE("Invaild media format");
-               return MEDIA_PACKET_ERROR_INVALID_OPERATION;
+       if (ret != MEDIA_FORMAT_ERROR_NONE) {
+               LOGE("failed to media_format_get_type()");
+               return MEDIA_PACKET_ERROR_INVALID_PARAMETER;
+       }
+       if (type != MEDIA_FORMAT_AUDIO && type != MEDIA_FORMAT_VIDEO) {
+               LOGE("invalid format type, type[0x%x]", type);
+               return MEDIA_PACKET_ERROR_INVALID_PARAMETER;
        }
 
        pool_handle = (media_packet_pool_s *)pool;
-
        pool_handle->fmt_h = fmt;
 
        return ret;