Update _mediacodec_foreach_supported_codec function 72/215072/1 accepted/tizen/unified/20191002.013359 submit/tizen/20191001.083909
authorJeongmo Yang <jm80.yang@samsung.com>
Tue, 1 Oct 2019 08:27:36 +0000 (17:27 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Tue, 1 Oct 2019 08:29:21 +0000 (17:29 +0900)
- Remove unnecessary callback with invalid argument
- Remove improper error log

[Version] 0.6.2
[Profile] Common
[Issue Type] Update

Change-Id: I3649cc7e101f86faaf8ede047c247ad21997fb78
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/capi-media-codec.spec
src/media_codec_port.c
test/media_codec_test.c

index 455600a..f540901 100755 (executable)
@@ -4,7 +4,7 @@
 
 Name:       capi-media-codec
 Summary:    A Media Codec library in Tizen Native API
-Version:    0.6.1
+Version:    0.6.2
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 804a7cb..d78a1d4 100644 (file)
@@ -800,7 +800,6 @@ int mc_set_supported_codec_cb(MMHandleType mediacodec, mediacodec_supported_code
 
 int _mediacodec_foreach_supported_codec(mediacodec_supported_codec_cb callback, void *user_data)
 {
-       int ret = MEDIACODEC_NONE;
        int i;
        int index;
 
@@ -814,19 +813,16 @@ int _mediacodec_foreach_supported_codec(mediacodec_supported_codec_cb callback,
        for (i = 0; i < CODEC_NR_ITEMS; i++) {
                if (codec[i]) {
                        index = (int)simple_to_codec_type_enumeration(i);
-                       if (!callback(index, user_data))
-                               goto CALLBACK_ERROR;
+                       if (!callback(index, user_data)) {
+                               LOGW("stop foreach callback");
+                               break;
+                       }
                }
        }
 
-       if (!callback(-1, user_data)) {
-               ret = MEDIACODEC_ERROR_INTERNAL;
-               goto CALLBACK_ERROR;
-       }
+       LOGD("done");
 
-CALLBACK_ERROR:
-       LOGD("foreach callback returned error");
-       return ret;
+       return MEDIACODEC_ERROR_NONE;
 }
 
 int mc_get_packet_pool(MMHandleType mediacodec, media_packet_pool_h *pool)
index dc46195..34a9945 100644 (file)
@@ -1405,12 +1405,6 @@ void _mediacodec_prepare(App *app, gboolean frame_all)
                        g_print("mediacodec_configure failed\n");
                break;
        case VIDEO_ENC:
-               media_format_set_video_mime(fmt, app->mime);
-               media_format_set_video_width(fmt, app->width);
-               media_format_set_video_height(fmt, app->height);
-               media_format_set_video_avg_bps(fmt, app->target_bits);
-               media_format_set_video_frame_rate(fmt, app->fps);
-
                media_format_create(&codec_format);
                media_format_set_video_mime(codec_format, codec_mime);
                media_format_set_video_width(codec_format, app->width);
@@ -1434,11 +1428,6 @@ void _mediacodec_prepare(App *app, gboolean frame_all)
                        g_print("mediacodec_configure failed\n");
                break;
        case AUDIO_ENC:
-               media_format_set_audio_mime(fmt, app->mime);
-               media_format_set_audio_channel(fmt, app->channel);
-               media_format_set_audio_samplerate(fmt, app->samplerate);
-               media_format_set_audio_bit(fmt, app->bit);
-
                media_format_create(&codec_format);
                media_format_set_audio_mime(codec_format, codec_mime);
                media_format_set_audio_channel(codec_format, app->channel);