Bug 11311

Summary: Media player is not play audio neither video on corei7-64_NUC
Product: [Build System, Metadata & Runtime] BSPs Reporter: oscar lopez arandas <oscarx.lopez.arandas>
Component: bsps-meta-intelAssignee: Jussi Kukkonen <jku>
Status: VERIFIED FIXED QA Contact: Juan Ramos <juan.fernandox.ramos.frayle>
Severity: normal    
Priority: Medium+ CC: california.l.sullivan, jku, jose.perez.carranza, rebecca.swee.fun.chang, ross.burton, sgw, todor.minchev
Version: 2.3   
Target Milestone: 2.3 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
video
none
audio
none
Failure log (480 theora with va)
none
Succesful log (theora 720 with va) none

Description oscar lopez arandas 2017-04-07 19:10:31 UTC
STATUS: IDLE
BUILD: 2.3 M3: meta-intel-rc1-eff56e4f0d59b1d965a68e4f009b7f07717b7edd
ENVIRONMENT: corei7-64_NUC
STEPS TO REPRODUCE: 
1. Launch media player
2. Add multiple files(5 files) in media player at same time (ogg or wav)
3. Verify the sound.

EXPECTED OUTCOME: Media player should be OK with this action, it reproduce files correctly.

ACTUAL OUTCOME:
Media player does not play any audio format or any type of video, does not play files properly.
Comment 1 California Sullivan 2017-04-11 00:03:47 UTC
Hi, I have a few questions before I tackle this.

1) Which version on NUC?
2) Which image did this occur on?
3) What media player do I run to reproduce this?

Thanks,
Cal
Comment 2 oscar lopez arandas 2017-04-11 13:58:44 UTC
hi, california sullivan

1. The version of the nuc is 6i5SYH.
2. In the images that occur are core-image-sato-sdk-corei7-64-hddimg and core-image-sato-sdk-core2-32-hddimg.
3. Was tested on the basic media player that has the nuc 6i5SYHse
Comment 3 oscar lopez arandas 2017-04-11 17:39:32 UTC
(In reply to comment #1)
> Hi, I have a few questions before I tackle this.
> 
> 1) Which version on NUC?

> 2) Which image did this occur on?


> 3) What media player do I run to reproduce this? 
> Thanks,
> Cal
Comment 4 California Sullivan 2017-04-14 21:28:39 UTC
I've been testing the media player under various platforms, and have found some interesting results:

qemu: plays .wav file and displays some sort of particle animation, can't tell if there is sound
Minnowboard Turbot: plays .wav file with sound, but no particle animation
NUC6: does not play the wav file, also no particle animation

Neither of the hardware tests had drm/snd failures in dmesg after attempting to play the file.

I also tried playing the file with VLC on both hardware platforms (same image), and both successfully played the file.

I'm not sure where the issue originates, but I am looking into it. There is a linux-intel kernel update today that I can try as well.
Comment 5 oscar lopez arandas 2017-04-17 19:20:53 UTC
Created attachment 3726 [details]
video
Comment 6 oscar lopez arandas 2017-04-17 19:21:40 UTC
Created attachment 3727 [details]
audio
Comment 7 Jussi Kukkonen 2017-04-18 10:20:24 UTC
> STEPS TO REPRODUCE: 
> 1. Launch media player
> 2. Add multiple files(5 files) in media player at same time (ogg or wav)
> 3. Verify the sound.

> Media player does not play any audio format or any type of video

Just verifying:
So you do not have any issues when selecting a single file at a time?
But when you select the two files you attached (or more), it doesn't do anything?
Comment 8 Jussi Kukkonen 2017-04-18 10:29:47 UTC
For reference, the visualizations are implemented using xv so are dependendent on the xorg driver. A bug in the visualization stack can prevent gstreamer from doing audio playback as well. It's possible to disable the visualizations somewhere in the UI: I'll test this once I've got a build.


Alos, We had bug 10041 during last release where we needed to bump xorg-video-intel to get support for the hardware mentioned in this bug.
Comment 9 Jussi Kukkonen 2017-04-18 13:02:21 UTC
I've tried this on core-image-sato with current master on a 6i5SYH with the two attached files and can't reproduce:
 * Click "Media Player" 
 * Select both files in file selector, click Open

Both files play (volume is at 0 by default: use the volume slider in app to hear the noise from the audio file). A visualization is shown during audio file playback.


California said:
> NUC6: does not play the wav file, also no particle animation

Which file is this? Currently the attachments are ogg/vorbis audio and ogg/theora video
Comment 10 Jose Perez C 2017-04-18 13:07:16 UTC
(In reply to comment #9)
> I've tried this on core-image-sato with current master on a 6i5SYH with the
We tested on core-image-sato-sdk for meta-intel corei7-64? did you use that one ? 
> two attached files and can't reproduce:
>  * Click "Media Player" 
>  * Select both files in file selector, click Open
> 
> Both files play (volume is at 0 by default: use the volume slider in app to
> hear the noise from the audio file). A visualization is shown during audio
> file playback.
> 
> 
> California said:
> > NUC6: does not play the wav file, also no particle animation
> 
> Which file is this? Currently the attachments are ogg/vorbis audio and
> ogg/theora video
Comment 11 Jussi Kukkonen 2017-04-18 13:44:29 UTC
(In reply to comment #10)
> We tested on core-image-sato-sdk for meta-intel corei7-64? did you use that
> one ? 

I did have meta-intel in my build, and yes it is corei7-64.

-sdk takes forever so I try to do that last... It did now finish and results for core-image-sato-sdk are the same: Both files play.
Comment 12 oscar lopez arandas 2017-04-18 13:49:33 UTC
(In reply to comment #7)
> > STEPS TO REPRODUCE: 
> > 1. Launch media player
> > 2. Add multiple files(5 files) in media player at same time (ogg or wav)
> > 3. Verify the sound.
> 
> > Media player does not play any audio format or any type of video
> 
> Just verifying:
> So you do not have any issues when selecting a single file at a time?
> But when you select the two files you attached (or more), it doesn't do
> anything?

Does not play any type of file since it is only one or two at a time
Comment 13 oscar lopez arandas 2017-04-18 14:10:29 UTC
(In reply to comment #9)

 
> Both files play (volume is at 0 by default: use the volume slider in app to
> hear the noise from the audio file). A visualization is shown during audio
> file playback.

> If you try with a single file with different format (ogg or wav) the audio control bar does not increase or decrease the audio, the play audio bar does not respond
Comment 14 Jussi Kukkonen 2017-04-18 14:32:01 UTC
Tested http://yocto-ab-master.jf.intel.com/pub/releases/yocto-2.3_M3.rc1/machines/intel-corei7-64/core-image-sato-sdk-intel-corei7-64.hddimg

This image does fail to play either file:
* no playback, no progress updates in UI
* gst-play works for audio file  (sounds horrible but I guess it's supposed to?)
* gst-play fails with the video

I've checked and there are no changes between meta-intel master and the one used in this M3 image. Poky has loads of changes. I'm going to build a test with the M3 poky to see if that triggers the problem but testing might only happen tomorrow (Wed).

my poky (works): 1fa1a7f174593e41b8bcf6c2f19565d6da44e991
M3 rc1 (fails):  eff56e4f0d59b1d965a68e4f009b7f07717b7edd


Below is output from gtk-play (the "Media Player" executable). It looks like libva is not able to open the driver. 
The application GObject warnings are unrelated and should not prevent playback.

---

# gtk-play /media/sdb/video 
libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0

(gtk-play:1538): GLib-GObject-WARNING **: instance with invalid (NULL) class pointer

(gtk-play:1538): GLib-GObject-CRITICAL **: g_signal_emit_valist: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(gtk-play:1538): GLib-GObject-CRITICAL **: g_object_set_qdata: assertion 'G_IS_OBJECT (object)' failed

(gtk-play:1538): GLib-GObject-WARNING **: instance with invalid (NULL) class pointer

(gtk-play:1538): GLib-GObject-CRITICAL **: g_signal_handlers_destroy: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(gtk-play:1538): GLib-GObject-WARNING **: instance with invalid (NULL) class pointer

(gtk-play:1538): GLib-GObject-CRITICAL **: g_signal_handlers_destroy: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
Comment 15 Saul Wold 2017-04-18 18:40:36 UTC
I did some further testing with the following SRCREVs:
Poky: master:1fa1a7f174593e41b8bcf6c2f19565d6da44e991"
meta-intel        = "update:c7e6889290901f4878f4bfc2180743d0870e55ba"

I tested with different kernels (linux-intel-4.9 and linux-yocto-4.10), it failed consistently with meta-intel normally enabled.

Then I disabled the va-intel HWCODEC and this infact fixed the problem, so some where in the va-intel codec we are actually breaking media, awesome!

I also tried to update the va-intel to 1.8.1, but that did not solve the problem.
Comment 16 Jussi Kukkonen 2017-04-19 07:49:36 UTC
(In reply to comment #15)
> I did some further testing with the following SRCREVs:
> Poky: master:1fa1a7f174593e41b8bcf6c2f19565d6da44e991"
> meta-intel        = "update:c7e6889290901f4878f4bfc2180743d0870e55ba"
> 
> I tested with different kernels (linux-intel-4.9 and linux-yocto-4.10), it
> failed consistently with meta-intel normally enabled.

So what is "normally enabled meta-intel"?  I thought meta-intel just works when you add it to your layers but now that look I don't have i965_drv_video.so at all in my builds...
Comment 17 Jussi Kukkonen 2017-04-19 09:48:02 UTC
(In reply to comment #16)
> (In reply to comment #15)
> > I did some further testing with the following SRCREVs:
> > Poky: master:1fa1a7f174593e41b8bcf6c2f19565d6da44e991"
> > meta-intel        = "update:c7e6889290901f4878f4bfc2180743d0870e55ba"
> > 
> > I tested with different kernels (linux-intel-4.9 and linux-yocto-4.10), it
> > failed consistently with meta-intel normally enabled.
> 
> So what is "normally enabled meta-intel"?  I thought meta-intel just works
> when you add it to your layers but now that look I don't have
> i965_drv_video.so at all in my builds...

Interesting. It looks like something goes wrong with rpm: with ipk packaging libva-intel-driver ends up on the image (and presumably breaks video playback). With rpm there is no libva-intel-driver even though va-intel is on the image and RDEPENDS on libva-intel-driver!
Comment 18 Jussi Kukkonen 2017-04-19 12:28:27 UTC
For the sake of clarity: The reason I wasn't seeing this bug was bug 11384.

I can now build images that have libva-intel-driver and now I do see this bug in them: Both the theora video and the visualizations for audio fail with the error mentioned.
Comment 19 Jussi Kukkonen 2017-04-20 07:30:54 UTC
I seem to be filing more bugs than fixing :(

I mentioned the trombone file sounding horrible: I've filed bug 11395 for that.
That problem only appears on my skylake NUC, but this video issue is present on both skylake and haswell
Comment 20 Jussi Kukkonen 2017-04-20 07:51:38 UTC
Also, I thought this meant the driver loading fails but I think I was wrong: this seems to be libva saying everything is going fine?

> libva info: Trying to open /usr/lib/dri/i965_drv_video.so
> libva info: Found init function __vaDriverInit_0_39
> libva info: va_openDriver() returns 0
Comment 21 Rebecca Chang 2017-04-20 09:49:05 UTC
Update from weitee:
Build and tested image with the following configurations:
Poky: master:1423508b29fc557d8a1305f39c33de33e28d9003
meta-intel        = "dev:250f40f6a36adbff6279d30636ff9b03e64e6b09"

Tested on Joule as the NUC refuses to work. Media player was unable to do playback.

When I was reviewing the configurations, weitee's build was using older commit ID of meta-intel. I suspected this is not the configuration that you are looking for.
Maybe it is too late to ask. Should we bisect Poky or meta-intel?
Comment 22 Jussi Kukkonen 2017-04-20 10:32:35 UTC
More testing with sintel-trailer with this matrix:

containers: mp4 (h264), mkv (h264), ogv (theora) 
resolutions: 480, 720, 1080
pipeline: with va driver and without

Files from https://download.blender.org/durian/trailer/

* The only failures are "ogv at 480 with va" and "ogv at 1080 with va"
* without va all codecs and sizes work
* h264 works in all resolutions, with or without va
* ogv/theora with va works at 720 !!

I've looked at the gstreamer pipelines: they are identical for the working case and non-working case. Here is what I think is the relevant debug output for failure case:

ERROR         vaapivideopool gstvaapivideobufferpool.c:253:gst_vaapi_video_buffer_pool_set_config:<vaapivideobufferpool0> no allocator defined
FIXME           videodecoder gstvideodecoder.c:945:gst_video_decoder_drain_out:<theoradec0> Sub-class should implement drain()
ERROR         vaapivideopool gstvaapivideobufferpool.c:253:gst_vaapi_video_buffer_pool_set_config:<vaapivideobufferpool1> no allocator defined
ERROR         vaapivideopool gstvaapivideobufferpool.c:322:gst_vaapi_video_buffer_pool_alloc_buffer:<vaapivideobufferpool1> no GstAllocator in buffer pool
WARN              bufferpool gstbufferpool.c:306:do_alloc_buffer:<vaapivideobufferpool1> alloc function failed
WARN                oggdemux gstoggdemux.c:1297:gst_ogg_pad_stream_out:<oggdemux0> could not submit packet for stream 5f7da35b, error: -5
WARN                oggdemux gstoggdemux.c:4851:gst_ogg_demux_loop:<oggdemux0> error: Internal data stream error.
WARN                oggdemux gstoggdemux.c:4851:gst_ogg_demux_loop:<oggdemux0> error: streaming stopped, reason error (-5)
ERROR             gst-player gstplayer.c:1160:error_cb:<player0> ERROR: from element /GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstOggDemux:oggdemux0: Internal data stream error.

I'll attach the full log
Comment 23 Jussi Kukkonen 2017-04-20 10:35:16 UTC
Created attachment 3742 [details]
Failure log (480 theora with va)
Comment 24 Jussi Kukkonen 2017-04-20 10:37:21 UTC
Created attachment 3743 [details]
Succesful log (theora 720 with va)

both logs were taken with 
  GST_DEBUG_DUMP_DOT_DIR=. GST_DEBUG=3 gst-play <filename>
(this also creates dot files that can be used to look at the gstreamer pipeline)
Comment 25 Saul Wold 2017-04-20 17:41:29 UTC
So I can now confirm that the issue appeared when we updated all of gstreamer from 1.8.2 -> 1.10.1.  So understanding the failure is all the more important.
Comment 26 Saul Wold 2017-04-21 17:39:45 UTC
> > How to debug:
> > * Play this gst-launch-1.0 -v  filesrc location= sintel_trailer-
> > 480p.ogv 
> > ! oggdemux ! theoradec  !  xvimagesink
> > It should work fine, theoradecoder get the bufferpool allocated by 
> > xvimagesink and the width seems to be 864
> > 
> > * play this gst-launch-1.0 -v  filesrc location= sintel_trailer-
> > 480p.ogv 
> > ! oggdemux ! theoradec  !  vaapisink
> > It is failing , because the buffer pool (allocated by vaapisink)
> > video 
> > meta width seems to be 854
> > 
> I will try this after lunch.
> 
So I can confirm that the first one indeed works, but the second one
fails.  I saw some errors about no alloctor being set:

0:00:01.301608344  1197       0x82d8f0 ERROR         vaapivideopool
gstvaapivideobufferpool.c:253:gst_vaapi_video_buffer_pool_set_config:<v
aapivideobufferpool0> no allocator defined
0:00:01.350399601  1197       0x82d8f0 ERROR         vaapivideopool
gstvaapivideobufferpool.c:322:gst_vaapi_video_buffer_pool_alloc_buffer:
<vaapivideobufferpool0> no GstAllocator in buffer pool


A gnome bug has been filed: https://bugzilla.gnome.org/show_bug.cgi?id=781577
Comment 27 Saul Wold 2017-04-24 00:28:10 UTC
Looks like upstream has a patch, we should build with that
Comment 28 Jussi Kukkonen 2017-04-25 08:09:30 UTC
Upstream is very helpful and made a patch for 1.10 branch as well. It looks good but I'm still testing a little before sending -- it looks like at least gtk-play visualizations are broken again (bug 11410).

There's a branch on poky-contrib: jku/gst-vaapi-fix
Comment 29 Jussi Kukkonen 2017-05-04 07:58:39 UTC
commit 081e0a28f2ec4453b6f3e9a36ea1e45b80752672
Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
Date:   Wed Apr 26 10:01:42 2017 +0300

    gstreamer1.0-vaapi: Fix playback breaking bug
    
    gstreamer-vaapi fails to play files with specific frame sizes
    because of buffer allocation issues. Fix is a backport.
    
    Fixes [YOCTO #11311].
    
    (From OE-Core rev: e01eb9b37ba5512d6fd9893c70b1f4d766fab2ac)
Comment 30 oscar lopez arandas 2017-05-16 19:28:05 UTC
Media player works well on audio and video in corei7-64_NUC

BB_VERSION        = "1.34.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "universal"
TARGET_SYS        = "x86_64-poky-linux"
MACHINE           = "intel-corei7-64"
DISTRO            = "poky"
DISTRO_VERSION    = "2.3"
TUNE_FEATURES     = "m64 corei7"
TARGET_FPU        = ""
meta              
meta-poky         
meta-yocto-bsp    = "HEAD:3e655f9c7f0f4f778dc9eedd9f7405fc84b4c9ad"
meta-intel        = "master:3afa94c979c984b978142170b8dbe6533ab8536c"

STEPS TO REPRODUCE: 
1. Launch media player
2. Add multiple files(5 files) in media player at same time (ogg or wav)
3. Verify the sound.

EXPECTED OUTCOME: Media player should be OK with this action, it reproduce files correctly.

ACTUAL OUTCOME:
Media player  playing  audio format or any type of video, play files properly.