AnsweredAssumed Answered

Gstreamer not working second time

Question asked by Gonzalo Fernandez on Mar 20, 2014
Latest reply on Sep 18, 2014 by Gonzalo Fernandez

Hi all,

 

I've been following this thread gstreamer: video fails to play when opened for second time but as I'm not sure if my problem is the same I'm opening a new one.

 

My problem is in a iMX28 custom board, and the code I'm running in my application is really trivial:

 

gst_init (NULL, NULL);

 

    /* Build the pipeline */

    pipeline = gst_parse_launch ("playbin2 uri=file:///mnt/gonzalo/Copreci-heart_x264_200x120_12000_15fps_320_22050.mp4", NULL);

 

    /* Start playing */

    gst_element_set_state (pipeline, GST_STATE_PLAYING);

 

    /* Wait until error or EOS */

    bus = gst_element_get_bus (pipeline);

    msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, GST_MESSAGE_ERROR | GST_MESSAGE_EOS);

 

    /* Free resources */

    if (msg != NULL)

gst_message_unref(msg);

    gst_object_unref(bus);

    gst_element_set_state(pipeline, GST_STATE_NULL);

    gst_object_unref(pipeline);

    gst_deinit();

 

First time I run this code in my application everything goes fine, the video is played nicely. Here is the log:

 

Aiur: 3.0.6

Core: MPEG4PARSER_06.04.27  build on Dec 20 2012 16:48:05

  mime: video/quicktime; audio/x-m4a; application/x-3gp

  file: /usr/lib/imx-mm/parser/lib_mp4_parser_arm9_elinux.so.3.1

Content Info:

        URI:

              file:///mnt/gonzalo/Copreci-heart_x264_200x120_12000_15fps_320_22050.mp4

        Idx File:

              /root/.aiur/.mnt.gonzalo.Copreci-heart_x264_200x120_12000_15fps_320_22050.mp4.ai

              dx

        Seekable  : Yes

        Size(byte): 18666817

 

Movie Info:

        Seekable  : Yes

        Live      : No

        Duration  : 0:01:41.000000000

        ReadMode  : File

        Track     : 2

 

Track 00 [video_000000] Enabled

        Duration: 0:01:41.000000000

        Language: eng

        Mime:

              video/x-h264, parsed=(boolean)true, width=(int)200, height=(int)120, framerate=(

              fraction)15/1, codec_data=(buffer)000000016742c00ddb0d11e59610000003001000000301

              e0f142ae0000000168ca8cb2

H264D_ARM9_02.06.01  build on Jul 12 2011 14:01:56.

MFW_GST_H264_DECODER_PLUGIN 3.0.6 build on Feb  5 2014 15:30:55.

Track 01 [audio_000000] Enabled

        Duration: 0:01:40.850000000

        Language: eng

        Mime:

              audio/mpeg, mpegversion=(int)1, framed=(boolean)true, channels=(int)2, rate=(int

              )22050, bitrate=(int)160013

MFW_GST_V4LSINK_PLUGIN 3.0.6 build on Feb  5 2014 15:30:44.

Beep: 3.0.6

Core: MP3 decoder Wrapper  build on Jan 16 2013 16:21:07

  mime: audio/mpeg, mpegversion = (int)1

  file: /usr/lib/imx-mm/audio-codec/wrap/lib_mp3d_wrap_arm9_elinux.so

CODEC: BLN_MAD-MMCODECS_MP3D_ARM_02.13.00_ARM9  build on Dec  5 2012 09:44:32.

>>V4L_SINK: Actually buffer status:

        hardware buffer : 21

        software buffer : 0

full screen size:480x272

[V4L Update Display]: left=0, top=0, width=480, height=272

Running time 0:01:40.940589569 render fps 14.157

Total rendered:1429

[--->FINALIZE aiurdemux

 

 

Second time my application runs the same code I get the following error:

 

(<unknown>:4591): GStreamer-CRITICAL **: gst_element_set_state: assertion `GST_IS_ELEMENT (element)' failed

 

(<unknown>:4591): GStreamer-CRITICAL **: gst_element_get_bus: assertion `GST_IS_ELEMENT (element)' failed

 

(<unknown>:4591): GStreamer-CRITICAL **: gst_bus_timed_pop_filtered: assertion `GST_IS_BUS (bus)' failed

 

(<unknown>:4591): GStreamer-CRITICAL **: gst_object_unref: assertion `object != NULL' failed

 

(<unknown>:4591): GStreamer-CRITICAL **: gst_element_set_state: assertion `GST_IS_ELEMENT (element)' failed

 

(<unknown>:4591): GStreamer-CRITICAL **: gst_object_unref: assertion `object != NULL' failed

 

If I restart my application, the previous code runs fine but once again, only the first time. I've also tried running the same code from a CHILD process. Doing it this way, the code DOESN'T FAIL, so looks something is not de-initializing properly. But in my application I don't want to run it in a child process, and would like to know what's wrong in this code.

 

Can someone help me?

 

Thanks in advance,

Gonzalo.

Outcomes