pipeline cannot play, halted in PAUSE

SpicyChicken xch0929 at 126.com
Thu Jun 25 23:14:19 PDT 2015


Hi,

I created a pipeline as following:

appsrc name=appsource ! video/x-h264,width=640,height=480,framerate=25 !
h264parse ! video/x-h264, stream-format=byte-stream ! mpegtsmux ! udpsink
host=192.168.77.13 port=9078 sync=false

the data pushed into appsrc buffer is h264 video data.

the source code as following:
    pipeline_str =     pipeline = g_strdup("appsrc name=appsource ! "
                        "video/x-h264,width=640,height=480,framerate=25 ! "
                        "h264parse ! "
                        "video/x-h264, stream-format=byte-stream ! "
                        "mpegtsmux ! "
                        "udpsink host=192.168.77.13 port=9078 sync=false");

    pipeline = gst_parse_launch(pipeline_str, &error);
    if (!pipeline) {
        logmsg(LOG_LEVEL_WARNING, "Cann't create pipeline: %s",
error->message);
        g_clear_error(&error);
    }
    DEBUG("Create pipeline: %s", pipeline_str);


    bus = gst_pipeline_get_bus(GST_PIPELINE (pipeline));
    g_assert(bus);

    gst_bus_add_watch(bus, (GstBusFunc)gst_bus_watch_callback, NULL);

    /* Get the appsrc */
    appsrc = gst_bin_get_by_name (GST_BIN(pipeline), "appsource");
    g_assert(appsrc);
    g_assert(GST_IS_APP_SRC(appsrc));

    /* setup */
    g_object_set (G_OBJECT (appsrc), "caps",
                  gst_caps_new_simple("video/x-h264",
                                      "width", G_TYPE_INT, 640,
                                      "height", G_TYPE_INT, 480,
                                      "framerate", G_TYPE_INT, 25,
                                      NULL), NULL);

    g_signal_connect(appsrc, "need-data", G_CALLBACK(pipeline_feed_data),
                    (gpointer)mpipeline);
    g_signal_connect(appsrc, "enough-data", G_CALLBACK(pipeline_stop),
                    (gpointer)mpipeline);

    result = gst_element_set_state(pipeline, GST_STATE_PLAYING);


the source code of need-data call back function:


    GstBuffer *buffer;
    media_pipeline *local;
    GstElement *appsrc;
    media_frame *frame = NULL;
    GstFlowReturn ret;
    GstMapInfo map;
    size_t size;
    void *data;

    local = (media_pipeline *)user_data;
    appsrc = local->appsrc;

    if ((frame = capture_get_frame(app_stream)) == NULL) {
        logmsg(LOG_LEVEL_WARNING, "Faild to get frame");
        return FALSE;
    }

    data = capture_frame_data(frame);
    g_assert(frame != NULL);
    size = capture_frame_size(frame);

    buffer = gst_buffer_new_allocate (NULL, size, NULL);
    gst_buffer_map(buffer, &map, GST_MAP_WRITE);

    memcpy(map.data, data + 4, size - 4);

    g_signal_emit_by_name(appsrc, "push-buffer", buffer, &ret);
    gst_buffer_unmap(buffer, &map);

    if (ret != GST_FLOW_OK) {
        DEBUG("Failed to push frame");
    }


but the pipeline state always halted in PAUSE, cannot changed into PLAYING.

Any one can help?
Thanks,




--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/pipeline-cannot-play-halted-in-PAUSE-tp4672464.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list