After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 762922 - Fail to play H265 video decode if the video in matroska container in gstreamer-vaapi
Fail to play H265 video decode if the video in matroska container in gstreame...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer-vaapi
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-03-01 13:01 UTC by Lim Siew Hoon
Modified: 2016-03-11 15:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
debug log (23.25 KB, text/plain)
2016-03-03 11:11 UTC, Lim Siew Hoon
  Details
gst_debug_h265.log (23.61 KB, text/plain)
2016-03-09 13:48 UTC, Lim Siew Hoon
  Details
Fix decoder: h265: Fix offset calculation in codec_data (862 bytes, patch)
2016-03-11 10:22 UTC, sreerenj
committed Details | Review

Description Lim Siew Hoon 2016-03-01 13:01:35 UTC
gstreamer framework 1.6.1 version
gstreamer-vaapi 1.6.0 or 0.7.1.1 version. 

For gstreamer-vaapi 1.6.0 version, I changed to gstreamer minimum requirement support to 1.6.1 instead 1.6.3 to run the test.

For gstreamer-vaapi master:
I changed to gstreamer minimum requirement support to 1.6.1 instead 1.7.1.1. to run the test.
And revert commit id for vp9 parser checking is been removed out from master branch (to avoid compilation error causing in my system that using 1.6.1) just to do test.


Most of the H265 video clip in matroska container format not able to play. But if I'm extract the video to elementary stream (without matroska container format), I'm able to play the video. 

I also test with master branch side, and this issue get fixed by this commit id in master branch:

From 6034734d733e8514e2aaa6d4d625b70985317b2c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?=
 <victorx.jaquez@intel.com>
Date: Wed, 17 Feb 2016 13:43:48 +0100
Subject: [PATCH] vaapidecode: use video decoder getcaps()

The usage of getcaps() vmethod is preferred than to handle manually the sink's
caps query.

In order to avoid function declarations, this patch moves the class_init()
method to the end of the file.
---
 gst/vaapi/gstvaapidecode.c | 120 +++++++++++++++++++--------------------------
 1 file changed, 50 insertions(+), 70 deletions(-)

Will you push this commit to 1.6 branch?
Comment 1 Lim Siew Hoon 2016-03-01 15:40:58 UTC
> For gstreamer-vaapi master:
> I changed to gstreamer minimum requirement support to 1.6.1 instead 1.7.1.1.
> to run the test.
> And revert commit id for vp9 parser checking is been removed out from master
> branch (to avoid compilation error causing in my system that using 1.6.1)
> just to do test.

I'm aware of the why the compilation error happen my system and reason behind mention inside this commmit id: 	f1bdf09cb4cc874e644b1a7ac81b536dc8fae1dd for "build: remove vp9 parser check" is been removed".


> 
> From 6034734d733e8514e2aaa6d4d625b70985317b2c Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?=
>  <victorx.jaquez@intel.com>
> Date: Wed, 17 Feb 2016 13:43:48 +0100
> Subject: [PATCH] vaapidecode: use video decoder getcaps()
> 
> The usage of getcaps() vmethod is preferred than to handle manually the
> sink's
> caps query.
> 
> In order to avoid function declarations, this patch moves the class_init()
> method to the end of the file.
> ---
>  gst/vaapi/gstvaapidecode.c | 120
> +++++++++++++++++++--------------------------
>  1 file changed, 50 insertions(+), 70 deletions(-)
> 
> Will you push this commit to 1.6 branch?

Tested using this commit, apply in gstreamer-vaapi 1.6.0 release, it is working.
Comment 2 Víctor Manuel Jáquez Leal 2016-03-01 16:33:42 UTC
You need to add another patch above that:

861ef4d (origin/master, master) vaapidecode: intersect with filter in getcaps()

That's the last in master right now. Because the patch you mention is incomplete. And I'm pretty sure that it is working by mistake :D

I don't have a computer with H.265 decoding capabilities for the moment. Could you upload the logs with GST_DEBUG="*:3,vaapi*:5" ??
Comment 3 Sebastian Dröge (slomo) 2016-03-02 08:46:21 UTC
So, is it fixed?
Comment 4 Víctor Manuel Jáquez Leal 2016-03-02 09:54:43 UTC
(In reply to Sebastian Dröge (slomo) from comment #3)
> So, is it fixed?

It is not, as far as I know. But also it is not clear for me what is the problem.
I need to see the logs.

(Thanks for the NEEDINFO tag)
Comment 5 Lim Siew Hoon 2016-03-02 13:29:50 UTC
(In reply to Víctor Manuel Jáquez Leal from comment #4)
> (In reply to Sebastian Dröge (slomo) from comment #3)
> > So, is it fixed?
> 
> It is not, as far as I know. But also it is not clear for me what is the
> problem.
> I need to see the logs.
> 
> (Thanks for the NEEDINFO tag)

I will get back the information for you asap. Currently my image is crash.
Comment 6 Lim Siew Hoon 2016-03-03 11:11:15 UTC
(In reply to Víctor Manuel Jáquez Leal from comment #2)
> You need to add another patch above that:
> 
> 861ef4d (origin/master, master) vaapidecode: intersect with filter in
> getcaps()
> 
> That's the last in master right now. Because the patch you mention is
> incomplete. And I'm pretty sure that it is working by mistake :D
> 
> I don't have a computer with H.265 decoding capabilities for the moment.
> Could you upload the logs with GST_DEBUG="*:3,vaapi*:5" ??


I'm cloning new image. To re-test again.  Ever with or without 2 patch [861ef4d (origin/master, master) vaapidecode: intersect with filter in getcaps() + vaapidecode: use video decoder getcaps() + 1.6.0 release code base]. It didn't work anymore. :(

Now very consistent getting the error same failure.

vainfo: 
root@intel-corei7-64:~# vainfo
libva info: VA-API version 0.38.1
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_38
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.38 (libva 1.6.3.pre1)
vainfo: Driver version: Intel i965 driver for Intel(R) Broxton - 1.6.3.pre1 (1.6.1-95-gc180143)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileH264MultiviewHigh      : VAEntrypointVLD
      VAProfileH264MultiviewHigh      : VAEntrypointEncSlice
      VAProfileH264StereoHigh         : VAEntrypointVLD
      VAProfileH264StereoHigh         : VAEntrypointEncSlice
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD


gst command pipeline:
gst-launch-1.0 -v filesrc location=/home/test/test_Main_at_L3.mkv ! matroskademux ! vaapidecode ! vaapisink

gstreamer 1.6.1 version
gst-plugins-base 1.6.1 version
gst-plugins-bad 1.6.1 version
gstreamer-vaapi 1.6.1 version.
Comment 7 Lim Siew Hoon 2016-03-03 11:11:49 UTC
Created attachment 322962 [details]
debug log

Attached the debug log.
Comment 8 Lim Siew Hoon 2016-03-03 11:19:31 UTC
I'm using mkvextract too to extract same video out from mkv file. It is working and able to play for same video. 

Example:
mkvextract.exe tracks hevc.mkv -f 0:bitstream.265
Comment 9 Lim Siew Hoon 2016-03-03 13:41:05 UTC
(In reply to Lim Siew Hoon from comment #8)
> I'm using mkvextract too to extract same video out from mkv file. It is
> working and able to play for same video. 
> 
> Example:
> mkvextract.exe tracks hevc.mkv -f 0:bitstream.265

Using this mkvextract tool to remove the mkv file container. 

gst command pipeline:
gst-launch-1.0 -v filesrc location=/home/test/bitsrream.265 ! h265parse ! vaapidecode ! vaapisink
Comment 10 Lim Siew Hoon 2016-03-09 13:48:12 UTC
Created attachment 323508 [details]
gst_debug_h265.log

Switch over to git master and using gstreamer environment: 1.7.90.
Still able to consistent reproduce the issue.

(gdb) bt
  • #0 parse_slice
    at gstvaapidecoder_h265.c line 1417
  • #1 gst_vaapi_decoder_h265_parse
    at gstvaapidecoder_h265.c line 2866
  • #2 do_parse
    at gstvaapidecoder.c line 163
  • #3 gst_vaapi_decoder_parse
    at gstvaapidecoder.c line 1008
  • #4 gst_vaapidecode_parse_frame
    at gstvaapidecode.c line 899
  • #5 gst_vaapidecode_parse
    at gstvaapidecode.c line 940
  • #6 gst_video_decoder_parse_available
    at gstvideodecoder.c line 1005
  • #7 gst_video_decoder_chain_forward
    at gstvideodecoder.c line 2207
  • #8 gst_video_decoder_chain
    at gstvideodecoder.c line 2503
  • #9 gst_pad_chain_data_unchecked
    at gstpad.c line 4155
  • #10 gst_pad_push_data
    at gstpad.c line 4407
  • #11 gst_pad_push
    at gstpad.c line 4526
  • #12 gst_matroska_demux_parse_blockgroup_or_simpleblock
    at matroska-demux.c line 3835
  • #13 gst_matroska_demux_parse_id
    at matroska-demux.c line 4487
  • #14 gst_matroska_demux_loop
    at matroska-demux.c line 4663
  • #15 gst_task_func
    at gsttask.c line 332
  • #16 ??
    from /usr/lib64/libglib-2.0.so.0
  • #17 ??
    from /usr/lib64/libglib-2.0.so.0
  • #18 start_thread
    at pthread_create.c line 337
  • #19 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 109


from parse_slice function, it call to gst_h265_parser_parse_slice_hdr function.

 if (nalu->type >= GST_H265_NAL_SLICE_BLA_W_LP
      && nalu->type <= RESERVED_IRAP_NAL_TYPE_MAX)
    READ_UINT8 (&nr, slice->no_output_of_prior_pics_flag, 1);

  READ_UE_MAX (&nr, pps_id, GST_H265_MAX_PPS_COUNT - 1);
  pps = gst_h265_parser_get_pps (parser, pps_id);
  if (!pps) {
    GST_WARNING
        ("couldn't find associated picture parameter set with id: %d", pps_id);
    return GST_H265_PARSER_BROKEN_LINK; -> exit from here due to pps is NULL.
 ...
Comment 11 sreerenj 2016-03-10 14:33:34 UTC
So this issue seems to be in git master too, right?
Please share the video sample...
Comment 12 Lim Siew Hoon 2016-03-11 09:18:53 UTC
 (In reply to sreerenj from comment #11)
> So this issue seems to be in git master too, right?
Yes, happen in master. 
> Please share the video sample...

I already share the link send to your office email. :D
Comment 13 sreerenj 2016-03-11 09:22:22 UTC
This is an issue while handling packetized stream (hvc) in vaapidecoder . if you convert to byte-stream (adding a  capsfilter "video/x-h265, stream-format=bytestream" after h265parse ) it will work.. We have to fix this. Hope i can have a look in the afternoon..
Comment 14 sreerenj 2016-03-11 10:22:47 UTC
Created attachment 323692 [details] [review]
Fix decoder: h265: Fix offset calculation in codec_data

Could you please have a try with this patch?
Comment 15 sreerenj 2016-03-11 15:50:08 UTC
Review of attachment 323692 [details] [review]:

pushed,
commit a486942ba2d44ba2f60fec25175c681786021b48
Author: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Date:   Fri Mar 11 17:44:07 2016 +0200

    decoder: h265: Fix offset calculation in codec_data parsing
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762922
Comment 16 sreerenj 2016-03-11 15:50:49 UTC
Closing, please feel free to reopen if issue persists.