Send eos event into appsrc when eos media packet 82/106582/1 accepted/tizen_3.0.m2_mobile accepted/tizen_3.0.m2_tv accepted/tizen_3.0.m2_wearable tizen_3.0.m2 tizen_3.0_tv accepted/tizen/3.0.m2/mobile/20170104.122111 accepted/tizen/3.0.m2/tv/20170104.122437 accepted/tizen/3.0.m2/wearable/20170104.122842 accepted/tizen/3.0/common/20161227.101436 accepted/tizen/3.0/ivi/20161226.025542 accepted/tizen/3.0/mobile/20161226.025451 accepted/tizen/3.0/tv/20161226.025512 accepted/tizen/3.0/wearable/20161226.025523 submit/tizen_3.0.m2/20170104.093749 submit/tizen_3.0/20161222.102746
authorGilbok Lee <gilbok.lee@samsung.com>
Thu, 22 Dec 2016 05:58:27 +0000 (14:58 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Thu, 22 Dec 2016 06:08:45 +0000 (15:08 +0900)
[Version] 0.1.7
[Profile] Common, Mobile, Wearable, TV
[Issue Type] Fix bugs

Change-Id: I45485a1257416d4e7ea3277aa45e8b49f823deb7

packaging/capi-mediamuxer.spec
src/port_gst/mediamuxer_port_gst.c

index 0f09465..a125ab0 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-mediamuxer
 Summary:    A Media Muxer library in Tizen Native API
-Version:    0.1.6
+Version:    0.1.7
 Release:    1
 Group:      Multimedia/API
 License:    Apache-2.0
index caa4f72..a1ea5c0 100755 (executable)
@@ -1146,14 +1146,17 @@ static int _gst_copy_media_packet_to_buf(mx_gst_track *current, media_packet_h o
                goto ERROR;
        }
        buffer->duration = info;
-       /* TBD: set falgs is not available now in media_packet */
+
        media_buffer_flags_e flags;
        if (media_packet_get_flags(out_pkt, &flags)) {
                MX_E("unable to get the buffer size\n");
                ret = MX_ERROR_UNKNOWN;
                goto ERROR;
        }
-       GST_BUFFER_FLAG_SET(buffer, flags);
+
+       if (flags & MEDIA_PACKET_SYNC_FRAME)
+               GST_BUFFER_FLAG_UNSET(buffer, GST_BUFFER_FLAG_DELTA_UNIT);
+
 ERROR:
        MEDIAMUXER_FLEAVE();
        return ret;
@@ -1167,6 +1170,7 @@ static int gst_muxer_write_sample(MMHandleType pHandle, int track_index,
        MEDIAMUXER_CHECK_NULL(pHandle);
        mxgst_handle_t *gst_handle = (mxgst_handle_t *) pHandle;
        mx_gst_track *current = NULL;
+       bool eos = FALSE;
        for (current = gst_handle->track_info.track_head; current; current = current->next)
                if (current->track_index == track_index)
                        break;
@@ -1191,7 +1195,16 @@ static int gst_muxer_write_sample(MMHandleType pHandle, int track_index,
        gst_inbuf2 = gst_buffer_new();
        /* ToDo: Add functionality to the following function */
        /* MX_I("\nBefore  buff=%x\n", gst_inbuf2); */
-       _gst_copy_media_packet_to_buf(current, inbuf, gst_inbuf2);
+       if (media_packet_is_end_of_stream(inbuf, &eos) != MEDIA_PACKET_ERROR_NONE) {
+               MX_E("media_packet_is_end_of_stream failed");
+               goto ERROR;
+       }
+
+       ret = _gst_copy_media_packet_to_buf(current, inbuf, gst_inbuf2);
+       if (ret != MX_ERROR_NONE) {
+               MX_E("media packet copy to gstbuffer error");
+               goto ERROR;
+       }
 
        if (track_index%NO_OF_TRACK_TYPES == 0) {  /* NO_OF_TRACK_TYPES*n for video */
                MX_I("Waiting till start_feed of current video track, index=%d is active\n", current->track_index);
@@ -1210,7 +1223,14 @@ static int gst_muxer_write_sample(MMHandleType pHandle, int track_index,
                if (ret != GST_FLOW_OK) {
                        /* We got some error, stop sending data */
                        MX_E("--video appsrc push failed--\n");
+                       ret = MX_ERROR_INVALID_ARGUMENT;
+               }
+
+               if (eos) {
+                       MX_I("end of stream");
+                       gst_app_src_end_of_stream((GstAppSrc *)current->appsrc);
                }
+
        } else if (track_index%NO_OF_TRACK_TYPES == 1) {        /* NO_OF_TRACK_TYPES*n+1 for audio */
                MX_I(" Waiting till start_feed of current audio track, index=%d is active\n", current->track_index);
 #ifdef ASYCHRONOUS_WRITE
@@ -1226,6 +1246,11 @@ static int gst_muxer_write_sample(MMHandleType pHandle, int track_index,
                        /* We got some error, stop sending data */
                        MX_E("--audio appsrc push failed--\n");
                }
+
+               if (eos) {
+                       MX_I("end of stream");
+                       gst_app_src_end_of_stream((GstAppSrc *)current->appsrc);
+               }
        } else if (track_index%NO_OF_TRACK_TYPES == 2) {        /* NO_OF_TRACK_TYPES*n+2 for subtitle */
                MX_I(" Waiting till start_feed of current subtitle, index=%d is active\n", current->track_index);
 #ifdef ASYCHRONOUS_WRITE
@@ -1241,6 +1266,10 @@ static int gst_muxer_write_sample(MMHandleType pHandle, int track_index,
                        /* We got some error, stop sending data */
                        MX_E("--subtitle appsrc push failed--\n");
                }
+               if (eos) {
+                       MX_I("end of stream");
+                       gst_app_src_end_of_stream((GstAppSrc *)current->appsrc);
+               }
        } else {
                MX_E("Unsupported track index=%d. track_index-mod3= %d. Only 0/1/2 track index is vaild\n", track_index, track_index%NO_OF_TRACK_TYPES);
                ret = MX_ERROR_INVALID_ARGUMENT;