Fixed svase issues 54/53254/1 accepted/tizen/mobile/20151204.052852 accepted/tizen/tv/20151204.052920 accepted/tizen/wearable/20151204.052941 submit/tizen/20151203.225303
authorGilbok Lee <gilbok.lee@samsung.com>
Thu, 3 Dec 2015 06:54:00 +0000 (15:54 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Thu, 3 Dec 2015 06:54:04 +0000 (15:54 +0900)
(WGID:1089, 10102, 10104, 10106, 10994, 14462)

Change-Id: Ib8d2530af9f9d274ae323cf81df7b0b9a25e1952
Signed-off-by: Gilbok Lee <gilbok.lee@samsung.com>
packaging/libmm-transcode.spec
transcode/mm_transcode.c
transcode/mm_transcode_seek.c

index f36dc13..35ff3f5 100644 (file)
@@ -1,7 +1,7 @@
 Name:       libmm-transcode
 Summary:    Multimedia Framework Video Transcode Library
 Version:    0.10
-Release:    1
+Release:    2
 Group:      System/Libraries
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
index 4759bf4..cbab70c 100755 (executable)
@@ -44,25 +44,25 @@ mm_transcode_create(MMHandleType* MMHandle)
        handle->decoder_vidp= g_new0 (handle_vidp_plugin_s, 1);
        if (!handle->decoder_vidp) {
                debug_error("[ERROR] - handle decoder video process bin");
-               return MM_ERROR_TRANSCODE_INTERNAL;
+               goto ERROR5;
        }
 
        handle->decoder_audp= g_new0 (handle_audp_plugin_s, 1);
        if (!handle->decoder_audp) {
                debug_error("[ERROR] - handle decoder audio process bin");
-               return MM_ERROR_TRANSCODE_INTERNAL;
+               goto ERROR4;
        }
 
        handle->encodebin= g_new0 (handle_encode_s, 1);
        if (!handle->encodebin) {
                debug_error("[ERROR] - handle encodebin");
-               return MM_ERROR_TRANSCODE_INTERNAL;
+               goto ERROR3;
        }
 
        handle->property = g_new0 (handle_property_s, 1);
        if (!handle->property) {
                debug_error("[ERROR] - handle property");
-               return MM_ERROR_TRANSCODE_INTERNAL;
+               goto ERROR2;
        }
 
        *MMHandle = (MMHandleType)handle;
@@ -72,10 +72,22 @@ mm_transcode_create(MMHandleType* MMHandle)
                handle->property->_MMHandle = 0;
        } else {
                debug_error("handle create Fail");
-               return MM_ERROR_TRANSCODE_INTERNAL;
+               goto ERROR1;
        }
 
        return ret;
+
+ERROR1:
+       TRANSCODE_FREE (handle->property);
+ERROR2:
+       TRANSCODE_FREE (handle->encodebin);
+ERROR3:
+       TRANSCODE_FREE (handle->decoder_audp);
+ERROR4:
+       TRANSCODE_FREE (handle->decoder_vidp);
+ERROR5:
+       TRANSCODE_FREE (handle);
+       return MM_ERROR_TRANSCODE_INTERNAL;
 }
 
 int
index d46853c..f84d1e5 100755 (executable)
@@ -153,6 +153,11 @@ _mm_cb_encodebin_sinkpad_event_probe(GstPad *pad, GstPadProbeInfo *info, gpointe
                new_segment = gst_segment_copy(segment);
                gst_event_unref (event);
 
+               if (!new_segment) {
+                       debug_error ("[ERROR] segment copy error");
+                       return GST_PAD_PROBE_REMOVE;
+               }
+
                new_segment->start = 0;
                new_segment->stop = handle->param->duration * G_GINT64_CONSTANT(1000000);
 
@@ -369,6 +374,11 @@ _mm_cb_transcode_bus(GstBus * bus, GstMessage * message, gpointer userdata)
                gchar *debug;
                gst_message_parse_error (message, &err, &debug);
 
+               if (!err) {
+                       debug_warning("Fail to parse error message");
+                       break;
+               }
+
                debug_error("[Source: %s] Error: %s",
                        GST_OBJECT_NAME(GST_OBJECT_CAST(GST_ELEMENT(GST_MESSAGE_SRC (message)))),
                        err->message);
@@ -381,10 +391,9 @@ _mm_cb_transcode_bus(GstBus * bus, GstMessage * message, gpointer userdata)
                        return FALSE;
                }
 
-               if (err) {
-                       g_error_free (err);
-                       err = NULL;
-               }
+               g_error_free (err);
+               err = NULL;
+
                TRANSCODE_FREE(debug);
                TRANSCODE_FREE(handle->param);
                /* g_main_loop_quit (handle->loop); */
@@ -493,8 +502,6 @@ _mm_cb_transcode_bus(GstBus * bus, GstMessage * message, gpointer userdata)
                        debug_log("[unlink] %s %d > %d", handle->param->outputfile, handle->param->start_pos, handle->property->total_length);
                }
                g_mutex_lock (handle->property->thread_mutex);
-               g_free(handle->param);
-               debug_log("g_free (param)");
                handle->param->completed = TRUE;
                handle->property->is_busy = FALSE;
                g_cond_signal(handle->property->thread_cond);