Add element creation/link for H265 46/86246/3 accepted/tizen/common/20160921.162251 accepted/tizen/ivi/20160922.042640 accepted/tizen/mobile/20160922.042420 accepted/tizen/tv/20160922.042513 submit/tizen/20160921.041639
authorSeokHoon Lee <andy.shlee@samsung.com>
Wed, 31 Aug 2016 07:51:56 +0000 (16:51 +0900)
committerSeokHoon Lee <andy.shlee@samsung.com>
Thu, 1 Sep 2016 04:50:56 +0000 (13:50 +0900)
add element creation/link for H265
remove static in function(__mm_wfd_sink_gst_element_add_bucket_to_bin, __mm_wfd_sink_gst_element_link_bucket)
change fopen to open for security issue.
fix typo GstWFDSessionTimeout and return state value.
add audio queue to audio sinkbin for audio hesitation issue.

[Version] 0.2.205
[Profile] Mobile
[Issue Type] Add features

Signed-off-by: SeokHoon Lee <andy.shlee@samsung.com>
Change-Id: If2b9db09af7158b3f48881a206de5594ffe61fd3

config/mmfw_wfd_sink.ini
packaging/libmm-wfd.spec
src/include/mm_wfd_sink_priv.h
src/mm_wfd_sink_ini.c
src/mm_wfd_sink_priv.c
src/mm_wfd_sink_util.c

index 6c06c954c3da63be76cdbcff010852eabd931d24..7bf50b2c3dd0c6561a6567d722f4e08198d00b21 100644 (file)
@@ -97,7 +97,7 @@ video h265 parser element =
 
 video h264 decoder element = avdec_h264
 
-video h265 decoder element = omx_uhd_h265dec;omx_tz_uhd_h265dec
+video h265 decoder element =
 
 video converter element =
 
index 01ac21e28edebe7f6b1c2f6a5a0113dd58bd01fc..505f0745eb0bc1f899f50b9a1f85006e697a24ba 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-wfd
 Summary:    Multimedia Framework Wifi-Display Library
-Version:    0.2.204
+Version:    0.2.205
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index ed25ef9e8c5324ed287206946f79bad61457b5a4..07876ab9a9aed185b474baaf2562bff59c2c07d8 100644 (file)
@@ -65,6 +65,7 @@ enum WFDSinkAudioSinkBinElementID {
        WFD_SINK_A_S_BIN = 0, /* NOTE : WFD_SINK_A_S_BIN should be zero */
        WFD_SINK_A_S_RESAMPLER,
        WFD_SINK_A_S_VOLUME,
+       WFD_SINK_A_S_QUEUE,
        WFD_SINK_A_S_SINK,
        WFD_SINK_A_S_NUM
 };
@@ -76,6 +77,8 @@ enum WFDSinkVideoDecodeBinElementID {
        WFD_SINK_V_D_HDCP,
        WFD_SINK_V_D_H264_PARSE,
        WFD_SINK_V_D_H264_DEC,
+       WFD_SINK_V_D_H265_PARSE,
+       WFD_SINK_V_D_H265_DEC,
        WFD_SINK_V_D_NUM
 };
 
@@ -264,4 +267,6 @@ int __mm_wfd_sink_create_audio_decodebin(mm_wfd_sink_t *wfd_sink);
 int __mm_wfd_sink_create_video_decodebin(mm_wfd_sink_t *wfd_sink);
 int __mm_wfd_sink_create_video_sinkbin(mm_wfd_sink_t *wfd_sink);
 int __mm_wfd_sink_create_audio_sinkbin(mm_wfd_sink_t *wfd_sink);
+int __mm_wfd_sink_gst_element_add_bucket_to_bin(GstBin *bin, GList *element_bucket, gboolean need_prepare);
+int __mm_wfd_sink_gst_element_link_bucket(GList *element_bucket);
 #endif
index ff6fef44defbd58a62baf9efb918d006b707bd18..ada5dcf7af356b16fdccc5349f5874b4dc9c0731 100644 (file)
@@ -25,6 +25,8 @@
 #include <stdlib.h>
 #include <iniparser.h>
 #include <mm_error.h>
+#include <fcntl.h>
+#include <unistd.h>
 
 #include "mm_wfd_sink_dlog.h"
 #include "mm_wfd_sink_enum.h"
@@ -176,23 +178,19 @@ static void __mm_wfd_sink_ini_check_status(const char *path);
 static
 gboolean __generate_sink_default_ini(void)
 {
-       FILE *fp = NULL;
+       int fd = 0;
        const gchar *default_ini = MM_WFD_SINK_DEFAULT_INI;
 
-
-       /* create new file */
-       fp = fopen(MM_WFD_SINK_INI_DEFAULT_PATH, "wt");
-
-       if (!fp)
+       fd = open(MM_WFD_SINK_INI_DEFAULT_PATH, O_CREAT | O_EXCL, 644);
+       if (fd < 0)
                return FALSE;
 
-       /* writing default ini file */
-       if (strlen(default_ini) != fwrite(default_ini, 1, strlen(default_ini), fp)) {
-               fclose(fp);
+       if (strlen(default_ini) != write(fd, default_ini, strlen(default_ini))) {
+               close(fd);
                return FALSE;
        }
+       close(fd);
 
-       fclose(fp);
        return TRUE;
 }
 #endif
index 427d8aad8e1b11434a9357d501f6f054fdfbb7b5..d6ccfd33cce655bc939d9d6274130360cafe6f47 100644 (file)
@@ -603,10 +603,6 @@ _mm_wfd_sink_msg_callback(GstBus *bus, GstMessage *msg, gpointer data)
                        GstState oldstate, newstate, pending;
                        const GstStructure *structure;
 
-                       /* we only handle messages from pipeline */
-                       if (msg->src != (GstObject *)wfd_sink->pipeline->mainbin[WFD_SINK_M_PIPE].gst)
-                               break;
-
                        /* get state info from msg */
                        structure = gst_message_get_structure(msg);
                        if (structure == NULL)
@@ -628,6 +624,10 @@ _mm_wfd_sink_msg_callback(GstBus *bus, GstMessage *msg, gpointer data)
                                                gst_element_state_get_name((GstState)newstate),
                                                gst_element_state_get_name((GstState)pending));
 
+                       /* we only handle messages from pipeline */
+                       if (msg->src != (GstObject *)wfd_sink->pipeline->mainbin[WFD_SINK_M_PIPE].gst)
+                               break;
+
                        if (oldstate == newstate) {
                                wfd_sink_debug("pipeline reports state transition to old state");
                                break;
@@ -698,11 +698,11 @@ _mm_wfd_sink_msg_callback(GstBus *bus, GstMessage *msg, gpointer data)
                                                                        MMWFDSINK_POST_MESSAGE(wfd_sink,
                                                                        MM_ERROR_WFD_INTERNAL,
                                                                        MMWFDSINK_CURRENT_STATE(wfd_sink));
-                               } else if (g_strrstr(structure_name, "GstWFDSrcSessionTimeout")) {
+                               } else if (g_strrstr(structure_name, "GstWFDSessionTimeout")) {
                                        wfd_sink_error("Got %s, post error message", GST_STR_NULL(structure_name));
                                        MMWFDSINK_POST_MESSAGE(wfd_sink,
                                                                        MM_ERROR_WFD_INTERNAL,
-                                                                       MMWFDSINK_CURRENT_STATE(wfd_sink));
+                                                                       MM_WFD_SINK_STATE_DISCONNECTED);
                                }
                        }
                }
@@ -804,7 +804,7 @@ _mm_wfd_sink_msg_callback(GstBus *bus, GstMessage *msg, gpointer data)
        return ret;
 }
 
-static int
+int
 __mm_wfd_sink_gst_element_add_bucket_to_bin(GstBin *bin, GList *element_bucket, gboolean need_prepare)
 {
        GList *bucket = element_bucket;
@@ -843,7 +843,7 @@ __mm_wfd_sink_gst_element_add_bucket_to_bin(GstBin *bin, GList *element_bucket,
        return successful_add_count;
 }
 
-static int
+int
 __mm_wfd_sink_gst_element_link_bucket(GList *element_bucket)
 {
        GList *bucket = element_bucket;
@@ -2811,6 +2811,11 @@ int __mm_wfd_sink_create_audio_sinkbin(mm_wfd_sink_t *wfd_sink)
        MMWFDSINK_PAD_PROBE(wfd_sink, NULL, a_sinkbin[WFD_SINK_A_S_VOLUME].gst,  "sink");
        MMWFDSINK_PAD_PROBE(wfd_sink, NULL, a_sinkbin[WFD_SINK_A_S_VOLUME].gst,  "src");
 
+       MMWFDSINK_CREATE_ELEMENT(a_sinkbin, WFD_SINK_A_S_QUEUE,
+                                                       wfd_sink->ini.name_of_audio_sinkbin_queue, "audio_sinkbin_queue", TRUE);
+       MMWFDSINK_PAD_PROBE(wfd_sink, NULL, a_sinkbin[WFD_SINK_A_S_QUEUE].gst,  "sink");
+       MMWFDSINK_PAD_PROBE(wfd_sink, NULL, a_sinkbin[WFD_SINK_A_S_QUEUE].gst,  "src");
+
        /* create sink */
        MMWFDSINK_CREATE_ELEMENT(a_sinkbin, WFD_SINK_A_S_SINK,
                        wfd_sink->ini.name_of_audio_sink, "audio_sink", TRUE);
@@ -2964,6 +2969,13 @@ int __mm_wfd_sink_link_video_decodebin(mm_wfd_sink_t *wfd_sink)
                        element_bucket = g_list_append(element_bucket, &v_decodebin[WFD_SINK_V_D_H264_DEC]);
                break;
 
+       case MM_WFD_SINK_VIDEO_CODEC_H265:
+               if (v_decodebin[WFD_SINK_V_D_H265_PARSE].gst)
+                       element_bucket = g_list_append(element_bucket, &v_decodebin[WFD_SINK_V_D_H265_PARSE]);
+               if (v_decodebin[WFD_SINK_V_D_H265_DEC].gst)
+                       element_bucket = g_list_append(element_bucket, &v_decodebin[WFD_SINK_V_D_H265_DEC]);
+               break;
+
        default:
                wfd_sink_error("video codec is not decied yet. cannot link video decpdebin...");
                return MM_ERROR_WFD_INTERNAL;
@@ -3384,6 +3396,24 @@ int __mm_wfd_sink_create_video_decodebin(mm_wfd_sink_t *wfd_sink)
                }
        }
 
+       if (video_codec & WFD_VIDEO_H265) {
+               /* create parser */
+               MMWFDSINK_CREATE_ELEMENT(v_decodebin, WFD_SINK_V_D_H265_PARSE, wfd_sink->ini.name_of_video_h264_parser, "video_h265_parser", FALSE);
+               MMWFDSINK_PAD_PROBE(wfd_sink, NULL, v_decodebin[WFD_SINK_V_D_H265_PARSE].gst,  "sink");
+               MMWFDSINK_PAD_PROBE(wfd_sink, NULL, v_decodebin[WFD_SINK_V_D_H265_PARSE].gst,  "src");
+
+               /* create dec */
+               MMWFDSINK_CREATE_ELEMENT(v_decodebin, WFD_SINK_V_D_H265_DEC, wfd_sink->ini.name_of_video_h265_decoder, "video_h265_dec", FALSE);
+               MMWFDSINK_PAD_PROBE(wfd_sink, NULL, v_decodebin[WFD_SINK_V_D_H265_DEC].gst,  "sink");
+               MMWFDSINK_PAD_PROBE(wfd_sink, NULL, v_decodebin[WFD_SINK_V_D_H265_DEC].gst,  "src");
+               if (v_decodebin[WFD_SINK_V_D_H265_DEC].gst) {
+                       if (MM_ERROR_NONE != __mm_wfd_sink_prepare_videodec(wfd_sink, v_decodebin[WFD_SINK_V_D_H265_DEC].gst)) {
+                               wfd_sink_error("failed to set video decoder property...");
+                               goto CREATE_ERROR;
+                       }
+               }
+       }
+
        g_list_free(element_bucket);
 
        /* take it */
index 50a1e91d6c5a85c5fdc884f273f7d52ecb93b3ff..e89d623f0662bf8654471d7b10dfcf7844454056 100644 (file)
@@ -25,7 +25,8 @@
 #include <tzplatform_config.h>
 #include "mm_wfd_sink_enum.h"
 
-#define DUMP_TS_DATA_PATH tzplatform_mkpath(TZ_SYS_VAR, "tmp/")
+#define DUMP_TS_DATA_PATH tzplatform_mkpath(TZ_SYS_VAR, "/tmp/")
+#define TS_DUMP_FILE_FORMAT "%s%s_%s.ts"
 
 static GstPadProbeReturn
 _mm_wfd_sink_util_dump(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
@@ -43,7 +44,7 @@ _mm_wfd_sink_util_dump(GstPad *pad, GstPadProbeInfo *info, gpointer u_data)
                return GST_PAD_PROBE_OK;
        }
 
-       snprintf(path, sizeof(path), "%s%s_%s.ts", DUMP_TS_DATA_PATH, gst_element_get_name(parent), gst_pad_get_name(pad));
+       snprintf(path, sizeof(path), TS_DUMP_FILE_FORMAT, DUMP_TS_DATA_PATH, gst_element_get_name(parent), gst_pad_get_name(pad));
        gst_object_unref(parent);
 
        if (info && info->type & GST_PAD_PROBE_TYPE_BUFFER) {
@@ -166,6 +167,10 @@ mm_wfd_sink_util_add_pad_probe_for_data_dump(GstElement *element, const gchar *p
                probe_pad = gst_element_get_static_pad(element, pad_name);
 
        if (probe_pad) {
+               char file_path[256] = {0, };
+               snprintf(file_path, sizeof(file_path), TS_DUMP_FILE_FORMAT, DUMP_TS_DATA_PATH, gst_element_get_name(element), pad_name);
+               remove(file_path);
+
                wfd_sink_debug("add pad(%s) probe", GST_STR_NULL(GST_PAD_NAME(probe_pad)));
                gst_pad_add_probe(probe_pad, GST_PAD_PROBE_TYPE_BUFFER, _mm_wfd_sink_util_dump, (gpointer)NULL, NULL);
                gst_object_unref(probe_pad);