Gstreamer not working second time

cancel
Showing results for 
Search instead for 
Did you mean: 

Gstreamer not working second time

Jump to solution
19,539 Views
gonfer
Contributor V

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.

Tags (2)
0 Kudos
1 Solution
5,467 Views
PeterChan
NXP Employee
NXP Employee

Hi Gonzalo,

I have attached the libmfw_gst_v4lsink.so extracted from the MM codec package 3.0.11. Please use this library file to replace the one in your rootfs. After the change, the repeat mode can work for your H.264 test vectors.

Thanks,

Peter

View solution in original post

0 Kudos
58 Replies
3,408 Views
Sasamy
Contributor IV

Hi Gonzalo,

I had a similar bug when I was building the Linux kernel (Freescale 2.6.35 on i.mx53) with the CodeSourcery compiler

Alexander

0 Kudos
3,408 Views
gonfer
Contributor V

Hi Alexander,

did you find a solution?

Thanks,

Gonzalo

0 Kudos
3,408 Views
Sasamy
Contributor IV

Hi Gonzalo,

Yeah, I just recompiled the kernel with another compiler without recompiling the entire root file system. Problems were with

gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203)

Alexander.

0 Kudos
3,408 Views
gonfer
Contributor V

Hi Alexander,

Freescale's L2.6.35_1.1.0_130130_images_MX28 image is built with the following toolchain:

Linux version 2.6.35.3-670-g914558e (r65388@szx32-17) (gcc version 4.6.2 20110630 (prerelease) (Freescale MAD -- Linaro 2011.07 -- Built at 2011/08/10 09:20) ) #1 PREEMPT Wed Jan 30 15:03:15 CST 2013

Anyway, I'll try to find a different toolchain (maybe from Yocto) and find out how to use it in Ltib.

Thanks,

Gonzalo.

0 Kudos
3,408 Views
gonfer
Contributor V

Bitbake is baking .......

Let's see what happens

0 Kudos
3,408 Views
gonfer
Contributor V

Well, just doesn't work.

I bitbaked fsl-image-test:

.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.

Build Configuration:

BB_VERSION        = "1.20.0"

BUILD_SYS         = "i686-linux"

NATIVELSBSTRING   = "Ubuntu-12.04"

TARGET_SYS        = "arm-poky-linux-gnueabi"

MACHINE           = "imx28evk"

DISTRO            = "poky"

DISTRO_VERSION    = "1.5.2"

TUNE_FEATURES     = "armv5 thumb dsp"

TARGET_FPU        = "soft"

meta             

meta-yocto        = "GONZALO:7c3f509c065960fed9445cd73e350b7c7ddfd521"

meta-oe           = "GONZALO:ee173678383683e972c7d4d6f0ef5790bfa50274"

meta-fsl-arm      = "GONZALO:5fdb620c09df11e70434092f675c891e0ba84108"

meta-fsl-arm-extra = "GONZALO:375f89b70655be2a17bbde36de6adb4e4a5a6975"

meta-fsl-demos    = "GONZALO:5a12677ad000a926d23c444266722a778ea228a7"

.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.

and when trying to play the video I get and error: Illegal Instruction.

.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.

root@imx28evk:/home/user/video#

8kHz_128kbps_131sec.mp4 /video# gplay Kaleidoscope_h264_qvga_387kbps_30fps_mp3_48

playbin2 is employed!

fsl_player_init(): Successfully initialize!

fsl_player_set_media_location(): filename=Kaleidoscope_h264_qvga_387kbps_30fps_mp3_48kHz_128kbps_131sec.mp4

[Stopped  ][Vol=01][00:00:00/00:00:00][fps:0]Aiur: 3.0.9

Core: MPEG4PARSER_06.07.00  build on Sep 10 2013 01:42:25

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

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

Content Info:

        URI:

              file:///home/user/video/Kaleidoscope_h264_qvga_387kbps_30fps_mp3_48kHz_128kbps_1

              31sec.mp4

        Idx File:

              /home/root/.aiur/.home.user.video.Kaleidoscope_h264_qvga_387kbps_30fps_mp3_48kHz

              _128kbps_131sec.mp4.aidx

        Seekable  : Yes

        Size(byte): 7689783

[Stopped  ][Vol=01][00:00:00/00:00:00][fps:0]Illegal instruction

root@imx28evk:/home/user/video#

.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.

If I use the gplay provided by Peter Chan, it also doesn't work:

.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.

_48kHz_128kbps_131sec.mp4 ideo# ./gplay Kaleidoscope_h264_qvga_387kbps_30fps_mp3_

playbin2 is employed!

fsl_player_init(): Successfully initialize!

fsl_player_set_media_location(): filename=Kaleidoscope_h264_qvga_387kbps_30fps_mp3_48kHz_128kbps_131sec.mp4

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

[Stopped  ][Vol=00][00:00:00/00:00:00][fps:160744729699921428480]Aiur: 3.0.9

Core: MPEG4PARSER_06.07.00  build on Sep 10 2013 01:42:25

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

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

Content Info:

        URI:

              file:///home/user/video/Kaleidoscope_h264_qvga_387kbps_30fps_mp3_48kHz_128kbps_1

              31sec.mp4

        Idx File:

              /home/root/.aiur/.home.user.video.Kaleidoscope_h264_qvga_387kbps_30fps_mp3_48kHz

              _128kbps_131sec.mp4.aidx

        Seekable  : Yes

        Size(byte): 7689783

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

[Stopped  ][Vol=00][00:00:00/00:00:00][fps:160744729699921428480] Aborted by signal Interrupt...

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

[Stopped  ][Vol=00][00:00:00/00:00:00][fps:160744729699921428480]Wait status change from 2 to 4

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

[Stopped  ][Vol=00][00:00:00/00:00:00][fps:160744729699921428480]fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

[Stopped  ][Vol=00][00:00:00/00:00:00][fps:160744729699921428480]Wait status change from 2 to 4

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

[Stopped  ][Vol=00][00:00:00/00:00:00][fps:160744729699921428480]fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

fsl_player_rotate(): Can not find auto_video_sink

.......................

.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.

0 Kudos
3,408 Views
PeterChan
NXP Employee
NXP Employee

Hi Gonzalo,

I use GDB to debug the gplay and dump the backtrace when mfw_gst_v4l2_close() is called to release the PXP. What is your backtrace when the first video plays to an end?

Breakpoint 2, 0x43931cac in mfw_gst_v4l2_close (v4l_info=0x107160)

    at mfw_gst_v4l.c:907

907    mfw_gst_v4l.c: No such file or directory.

        in mfw_gst_v4l.c

(gdb) backtrace

#0  0x43931cac in mfw_gst_v4l2_close (v4l_info=0x107160) at mfw_gst_v4l.c:907

#1  0x439357b0 in mfw_gst_v4lsink_finalize (object=0x107160)

    at mfw_gst_v4lsink.c:1734

#2  0x402751d4 in IA__g_object_unref (_object=0x107160) at gobject.c:2991

#3  0x401e2ec8 in gst_message_finalize (message=0x16e280) at gstmessage.c:185

#4  0x401e6f6c in gst_mini_object_unref (mini_object=0x16e280)

    at gstminiobject.c:604

#5  0x401c15c0 in gst_bus_source_dispatch (source=0x968b8,

    callback=<value optimized out>, user_data=0x15040) at gstbus.c:971

#6  0x404df140 in IA__g_main_context_dispatch (context=0x17a00) at gmain.c:3276

#7  0x404df738 in g_main_context_iterate (context=0x17a00,

    block=<value optimized out>, dispatch=1) at gmain.c:3276

#8  0x404df984 in IA__g_main_context_iteration (context=0x17a00, may_block=0)

    at gmain.c:3276

#9  0x4002b690 in g_main_loop_thread_fun (data=<value optimized out>)

    at mfw_gplay_core.c:1417

#10 0x4050584c in g_thread_create_proxy (data=0x95730) at gthread.c:180

#11 0x40052cd0 in start_thread () from /lib/libpthread.so.0

#12 0x40130418 in clone () from /lib/libc.so.6

0 Kudos
3,408 Views
gonfer
Contributor V

Hi Peter,

my gbd skills are quite limited. I've installed gdb on the evk and I'm able to launch gplay on gdb, run the mp4 video, set breakpoints, backtrace... but don't know how to set a break point at mfw_gst_v4l.c:907

Please, could you guide me on this??

Thanks,

Gonzalo.

0 Kudos
3,408 Views
PeterChan
NXP Employee
NXP Employee

I just set the breakpoint to the function "mfw_gst_v4l2_close" by GDB command "break mfw_gst_v4l2_close". When the gplay stops at the breakpoint, run "backtrace" command to print the stack trace.

More information about GDB commands can be found at http://www.yolinux.com/TUTORIALS/GDB-Commands.html.

Since there is no "FINALIZE v4l_sink" in your log, I don't expect the gplay will stop at the mfw_gst_v4l2_close() breakpoint in your test.

0 Kudos
3,408 Views
gonfer
Contributor V

Thanks a lot, Peter !!

As you were expecting, gplay doesn't stop at mfw_gst_v4l2_close().  Attached you can find the complete log.

The log is from the iMX28-evk running L2.6.35_1.1.0_130130_images_MX28, where I've deleted the original "gplay" and have run the patched "gplay" with the bug you found already fixed.

Previously I tried the original "gplay" with the same results.

Furthermore, I've never seen the "FINALIZE v4l_sink" message, even if a run "gplay" with no repetitions.

Thanks,

Gonzalo.

0 Kudos
3,408 Views
PeterChan
NXP Employee
NXP Employee

I have no idea why the "FINALIZE v4l_sink" did not execute even we are using the same prebuilt image. Are you using the MX28 LCD daughter card MCIMX28LCD Seiko 4/3" WVGA Rev B? Can we testing with the same video?

This video is transcoded from https://community.freescale.com/docs/DOC-93383 with the setting {Video codec: MPEG-4 constant framerate & quality, Audio Codec: MP3 (Lame) 128kbps 44100 Hz}.  Using this video, "FINALIZE v4l_sink" will execute when it plays to an end in gplay.

0 Kudos
3,408 Views
gonfer
Contributor V

Hi Peter,

Yes, I'm using the iMX28-evk with a "MCIMX28LCD Seiko 4/3" WVGA Rev B"

You are right !!!  Your video file is playing fine, repeating continously with no problem, and I can see the expected [--->FINALIZE v4l_sink at the end of every repetition.

I'm attaching the complete log for 4 repetitions.

Do you know what could be the problem decoding my video file?

Thanks,

Gonzalo.

0 Kudos
3,410 Views
PeterChan
NXP Employee
NXP Employee

My video transcoder is downloaded from HandBrake: Open Source Video Transcoder.

Can you share your video to me so that we can further investigate this issue?

Does this problem all happen to all videos you got? How did you get these videos?

0 Kudos
3,410 Views
gonfer
Contributor V

Hi Peter,

you can find the video file I was using in this same thread, in my post on

)

Thanks,

Gonzalo.

0 Kudos
3,410 Views
PeterChan
NXP Employee
NXP Employee

Would you please transcode the video at  https://community.freescale.com/docs/DOC-93383 and send me to test?

0 Kudos
3,410 Views
gonfer
Contributor V

Yes, I'll do it tomorrow. I'm out of the office and don't have access to a Windows machine.

Thanks,

Gonzalo

0 Kudos
3,410 Views
gonfer
Contributor V

Hi Peter,

attached you can find 2 video files I've got transcoding VID_20120917_211055[1].mp4

Both of them don't play smoothly at all on the iMX28evk but when playing

- VID_20120917_211055[1]_x264_KO.mp4: it shows the problem I've reported in this thread.

- VID_20120917_211055[1]_x264_OK.mp4: gplay can repeat it with no problem.


Thanks,

Gonzalo.

0 Kudos
3,410 Views
gonfer
Contributor V

Hi again Peter,

I've been doing a lot of testing during this weekend and haven't come to a conclusion but I've got some filling.

The issue looks to be related to how the video is encoded in the mp4 file:

- MPEG-4 encoded video plays quite smoothly, and I think I've always seen the [--->FINALIZE v4l_sink message at the end of every repetition.

- H.264 (x264) encoded video plays more chunky, and it's hard to get a file that shows the [--->FINALIZE v4l_sink message at the end of every repetition.

Does this make any sense for you?

Thanks,

Gonzalo.

0 Kudos
3,410 Views
PeterChan
NXP Employee
NXP Employee

I agree with your findings. In your application, is it mandatory to have H.264 support in your application? It looks the H.264 decode is more CPU demanding for the same video quality.

0 Kudos
3,410 Views
gonfer
Contributor V

Unfortunately, yes, h.264 is required.

0 Kudos