Free codec_data from media_packet_get_codec_data() 50/291150/1 accepted/tizen/unified/20230413.123735
authorJeongmo Yang <jm80.yang@samsung.com>
Tue, 11 Apr 2023 01:17:08 +0000 (10:17 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Tue, 11 Apr 2023 01:17:55 +0000 (10:17 +0900)
- The bug from media_packet_get_codec_data() has been fixed.
  : https://review.tizen.org/gerrit/#/c/platform/core/api/mediatool/+/291013/

[Version] 0.0.11
[Issue Type] Update

Change-Id: I6c86ed717c674ad6b6b977fd7534e5da054f0e81
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/esplusplayer.spec
test/esplusplayer_test.c

index d9ce248..e850597 100644 (file)
@@ -2,7 +2,7 @@
 %bcond_without ESPLUSPLAYER_UT
 Name:       esplusplayer
 Summary:    new multimedia streaming player
-Version:    0.0.10
+Version:    0.0.11
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index f820dac..da2ace3 100644 (file)
@@ -572,6 +572,8 @@ static void __test_set_audio_stream_info()
        int channels = 0;
        int rate = 0;
        int bit = 0;
+       void *codec_data = NULL;
+       unsigned int codec_data_length = 0;
        media_packet_h audbuf;
        esplusplayer_audio_stream_info audio_info = {0, };
 
@@ -607,8 +609,6 @@ static void __test_set_audio_stream_info()
        if (ret != MEDIADEMUXER_ERROR_NONE) {
                g_print("Error (%d) return of (Audio) mediademuxer_read_sample()\n", ret);
        } else {
-               void *codec_data = NULL;
-               unsigned int codec_data_length = 0;
                g_test_h->streams[AUDIO_STREAM].pending_packet = audbuf;
                if (media_packet_get_codec_data (audbuf, &codec_data, &codec_data_length) == MEDIA_PACKET_ERROR_NONE) {
                        g_print("Audio has codec data\n");
@@ -628,6 +628,9 @@ static void __test_set_audio_stream_info()
        else
                g_print("                       => esplusplayer_set_audio_stream_info() success\n");
 
+       if (codec_data)
+               free(codec_data);
+
        g_test_h->streams[AUDIO_STREAM].activate = true;
 }
 
@@ -639,6 +642,8 @@ static void __test_set_video_stream_info()
        int width = 0;
        int height = 0;
        int framerate = 0;
+       void *codec_data = NULL;
+       unsigned int codec_data_length = 0;
        media_packet_h vidbuf;
 
        esplusplayer_video_stream_info video_info = {0, };
@@ -681,8 +686,6 @@ static void __test_set_video_stream_info()
        if (ret != MEDIADEMUXER_ERROR_NONE) {
                g_print("Error (%d) return of (Video) mediademuxer_read_sample()\n", ret);
        } else {
-               void *codec_data = NULL;
-               unsigned int codec_data_length = 0;
                g_test_h->streams[VIDEO_STREAM].pending_packet = vidbuf;
                if (media_packet_get_codec_data (vidbuf, &codec_data, &codec_data_length) == MEDIA_PACKET_ERROR_NONE) {
                        g_print("Video has codec data\n");
@@ -702,6 +705,9 @@ static void __test_set_video_stream_info()
        else
                g_print("                       => esplusplayer_set_video_stream_info() success\n");
 
+       if (codec_data)
+               free(codec_data);
+
        g_test_h->streams[VIDEO_STREAM].activate = true;
 }