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 754845 - compilation fails if built in codec parsers are disabled
compilation fails if built in codec parsers are disabled
Status: RESOLVED FIXED
Product: gstreamer-vaapi
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gstreamer-vaapi maintainer(s)
gstreamer-vaapi maintainer(s)
Depends on:
Blocks: 750547 754843
 
 
Reported: 2015-09-10 17:27 UTC by Víctor Manuel Jáquez Leal
Modified: 2015-09-17 13:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
build: verify for H264 MVC and H265 SPS (2.00 KB, patch)
2015-09-11 14:44 UTC, Víctor Manuel Jáquez Leal
none Details | Review
decoder: h264: initialize PPS's slice_group_id (1.49 KB, patch)
2015-09-11 14:55 UTC, Víctor Manuel Jáquez Leal
none Details | Review
build: verify for H264 MVC and H265 SPS (2.00 KB, patch)
2015-09-14 18:09 UTC, Víctor Manuel Jáquez Leal
none Details | Review
decoder: h264: initialize PPS's slice_group_id (1.49 KB, patch)
2015-09-14 18:09 UTC, Víctor Manuel Jáquez Leal
none Details | Review
patches/videoparsers: h264parser: refresh patches (4.61 KB, patch)
2015-09-14 18:09 UTC, Víctor Manuel Jáquez Leal
none Details | Review
patches/videoparsers: h264parser: fix description and refresh (6.58 KB, patch)
2015-09-14 18:09 UTC, Víctor Manuel Jáquez Leal
none Details | Review
patches/videoparsers: h264parser: more API fences and refresh (3.08 KB, patch)
2015-09-14 18:09 UTC, Víctor Manuel Jáquez Leal
none Details | Review
patches/videoparsers: h265parser: rename patch keeping number (3.33 KB, patch)
2015-09-14 18:09 UTC, Víctor Manuel Jáquez Leal
none Details | Review
patches/videoparsers: h265parser: more API fences (3.23 KB, patch)
2015-09-14 18:09 UTC, Víctor Manuel Jáquez Leal
none Details | Review
decoder: h264: initialize PPS's slice_group_id (1.49 KB, patch)
2015-09-15 17:52 UTC, Víctor Manuel Jáquez Leal
committed Details | Review
build: verify for H264 MVC and H265 SPS (2.15 KB, patch)
2015-09-15 17:52 UTC, Víctor Manuel Jáquez Leal
committed Details | Review
build: link libgstvaapi_parse against codec parser (1.76 KB, patch)
2015-09-15 17:52 UTC, Víctor Manuel Jáquez Leal
committed Details | Review
patches/videoparsers: h264parser: refresh patches (4.61 KB, patch)
2015-09-15 17:52 UTC, Víctor Manuel Jáquez Leal
committed Details | Review
patches/videoparsers: h264parser: fix description and refresh (7.18 KB, patch)
2015-09-15 17:52 UTC, Víctor Manuel Jáquez Leal
committed Details | Review
patches/videoparsers: h264parser: more API fences and refresh (3.23 KB, patch)
2015-09-15 17:53 UTC, Víctor Manuel Jáquez Leal
committed Details | Review
patches/videoparsers: h265parser: rename patch keeping number (3.19 KB, patch)
2015-09-15 17:53 UTC, Víctor Manuel Jáquez Leal
committed Details | Review
patches/videoparsers: h265parser: more API fences (3.22 KB, patch)
2015-09-15 17:53 UTC, Víctor Manuel Jáquez Leal
committed Details | Review

Description Víctor Manuel Jáquez Leal 2015-09-10 17:27:25 UTC
I'm filing this bug on behalf of the reporter of 

http://lists.freedesktop.org/archives/gstreamer-devel/2015-September/054341.html

The compilation of gstreamer-vaapi fails if --enable-builtin-codecparsers=no is set and gstreamer-1.5 is not used / linked.

This is because mvc/hevc parsing was added in gstreamer-1.5 and the API calls are not fenced.
 
So, either we check for gstreamer 1.5 if the built in codec parsers are not enabled, or we fence all the MVC/HEVC stuff verifying that we are using either gstreamer-1.5 or the built in codec parsers.

I lean towards the first option, which is the simplest: in configure.ac, if codec-parsers are disabled, gstreamer-1.5 (at least) must be found.

The other option is to modify a lot of code to fence all these.
Comment 1 sreerenj 2015-09-11 11:24:15 UTC
(In reply to Víctor Manuel Jáquez Leal from comment #0)
> I'm filing this bug on behalf of the reporter of 
> 
> http://lists.freedesktop.org/archives/gstreamer-devel/2015-September/054341.
> html
> 
> The compilation of gstreamer-vaapi fails if --enable-builtin-codecparsers=no
> is set and gstreamer-1.5 is not used / linked.
> 
> This is because mvc/hevc parsing was added in gstreamer-1.5 and the API
> calls are not fenced.

Which API ?? I can see some 1.5 protection code for mvc in gstvaapidecoder_h264.c and another patch in patches/videoparsers for disabling 3d in older version...
Not sufficient ???

>  
> So, either we check for gstreamer 1.5 if the built in codec parsers are not
> enabled, or we fence all the MVC/HEVC stuff verifying that we are using
> either gstreamer-1.5 or the built in codec parsers.
> 
> I lean towards the first option, which is the simplest: in configure.ac, if
> codec-parsers are disabled, gstreamer-1.5 (at least) must be found.
> The other option is to modify a lot of code to fence all these.
Comment 2 sreerenj 2015-09-11 11:36:46 UTC
Aha, you are right!

I would also go for option-1 ,even though it is bit awkward  :)
Comment 3 sreerenj 2015-09-11 11:39:18 UTC
Also I think a fix is needed even in against 1.5 as per http://lists.freedesktop.org/archives/libva/2015-September/003519.html..
Comment 4 Víctor Manuel Jáquez Leal 2015-09-11 14:44:28 UTC
Created attachment 311150 [details] [review]
build: verify for H264 MVC and H265 SPS

Currently the H264 and H265 parsers look for MVC and SPS respectively, and
the required symbols for those were added in GStreamer 1.5

This patch verifies if the installed H264 and H265 parser have those symbols. If
they do not have them, the built in parsers are enabled used.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Comment 5 Víctor Manuel Jáquez Leal 2015-09-11 14:55:10 UTC
Created attachment 311153 [details] [review]
decoder: h264: initialize PPS's slice_group_id

When the GstVaapiParserInfoH264 is allocated, the memory is not initialized,
so it contains random data.

When gst_h264_parser_parse_pps() fails, the PPS structure keeps slice_group_id
pointer uninitialized, leading to a segmentation fault when the memory is
freed.

This patch prevents this by initializing the slice_group_id before the PPS
parsing.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Comment 6 sreerenj 2015-09-11 15:08:15 UTC
(In reply to Víctor Manuel Jáquez Leal from comment #4)
> Created attachment 311150 [details] [review] [review]
> build: verify for H264 MVC and H265 SPS
> 
> Currently the H264 and H265 parsers look for MVC and SPS respectively, and
> the required symbols for those were added in GStreamer 1.5
> 
> This patch verifies if the installed H264 and H265 parser have those
> symbols. If
> they do not have them, the built in parsers are enabled used.
> 
> Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>

patch applied:
build with --enable-builtin-codecparsers=no

1:4: gst-inspect-1.0 vaapiparse_h264 libgstvaapi_parse.so: undefined symbol: GST_PAD_SET_ACCEPT_TEMPLATE


1.2: gst-inspect-1.0 vaapiparse_h264: undefined symbol: gst_base_parse_merge_tags


1.6: gst-inspect-1.0 vaapiparse_h264: libgstvaapi_parse.so: undefined symbol: gst_h265_parser_free

Am I messing-up something ? :)
Comment 7 Víctor Manuel Jáquez Leal 2015-09-11 15:45:45 UTC
> 
> patch applied:
> build with --enable-builtin-codecparsers=no
> 
> 1:4: gst-inspect-1.0 vaapiparse_h264 libgstvaapi_parse.so: undefined symbol:
> GST_PAD_SET_ACCEPT_TEMPLATE
> 
> 
> 1.2: gst-inspect-1.0 vaapiparse_h264: undefined symbol:
> gst_base_parse_merge_tags
> 
> 
> 1.6: gst-inspect-1.0 vaapiparse_h264: libgstvaapi_parse.so: undefined
> symbol: gst_h265_parser_free
> 
> Am I messing-up something ? :)

Aha! ... I worked on this patch also disabling the video parsers: --enable-builtin-videoparser=no

When the video parsers are enable, I see these errors too.

Right now I'm working in GStreamer 1.4

GST-PAD-SET-ACCEPT-TEMPLATE was added in GStreamer 1.5
But patches/videoparsers/0002-h264parse-fix-build-with-older-GStreamer-1.x-stacks.patch enables it for GStreamer 1.3

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstPad.html#GST-PAD-SET-ACCEPT-TEMPLATE:CAPS

And we also need a similar patch for gsth265parse.c, which is not fenced.

In the case of gst_base_parse_merge_tags(), it was added in GStreamer 1.5 and there is no patch to fence it. The same for gst_h265_parser_free().

Perhaps we shall only enable gsth265parse.c only when compiling against gstreamer 1.5 or above.
Comment 8 Engin FIRAT 2015-09-11 15:54:11 UTC
I got the same results too with sreenj. Additionally, I don't get the element vaapiparse_h264 in case builtin-codecparsers are not disabled. The shared object libgstvaapi_parse.so is produced but after make install, the so does not get copied to specified location. Moreover gst-inspect -b does not list any blacklisted files and vaapiparse_h264 is not shown by gst-inspect vaapi.
Comment 9 sreerenj 2015-09-11 15:58:04 UTC
(In reply to Víctor Manuel Jáquez Leal from comment #7)

> 
> Perhaps we shall only enable gsth265parse.c only when compiling against
> gstreamer 1.5 or above.

You mean, if --enable-builtin-codecparsers=no , right?
Comment 10 sreerenj 2015-09-11 16:00:01 UTC
(In reply to Engin FIRAT from comment #8)
> I got the same results too with sreenj. Additionally, I don't get the
> element vaapiparse_h264 in case builtin-codecparsers are not disabled. The
> shared object libgstvaapi_parse.so is produced but after make install, the
> so does not get copied to specified location. Moreover gst-inspect -b does
> not list any blacklisted files and vaapiparse_h264 is not shown by
> gst-inspect vaapi.

I think Your issue (http://lists.freedesktop.org/archives/gstreamer-devel/2015-September/054341.html) can be fixed by adding a conditional compilation in gst/vaapi/Makefilea.am
Comment 11 Víctor Manuel Jáquez Leal 2015-09-14 18:09:20 UTC
Created attachment 311301 [details] [review]
build: verify for H264 MVC and H265 SPS

Currently the H264 and H265 parsers look for MVC and SPS respectively, and
the required symbols for those were added in GStreamer 1.5

This patch verifies if the installed H264 and H265 parser have those symbols. If
they do not have them, the built in parsers are enabled used.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Comment 12 Víctor Manuel Jáquez Leal 2015-09-14 18:09:25 UTC
Created attachment 311302 [details] [review]
decoder: h264: initialize PPS's slice_group_id

When the GstVaapiParserInfoH264 is allocated, the memory is not initialized,
so it contains random data.

When gst_h264_parser_parse_pps() fails, the PPS structure keeps slice_group_id
pointer uninitialized, leading to a segmentation fault when the memory is
freed.

This patch prevents this by initializing the slice_group_id before the PPS
parsing.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Comment 13 Víctor Manuel Jáquez Leal 2015-09-14 18:09:31 UTC
Created attachment 311303 [details] [review]
patches/videoparsers: h264parser: refresh patches

In order to avoid the creation of .orig files and break the distcheck target.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Comment 14 Víctor Manuel Jáquez Leal 2015-09-14 18:09:37 UTC
Created attachment 311304 [details] [review]
patches/videoparsers: h264parser: fix description and refresh

Fix a typo in the patch description and refresh it in order to avoid the
creation of .orig files and break the distcheck target.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Comment 15 Víctor Manuel Jáquez Leal 2015-09-14 18:09:42 UTC
Created attachment 311305 [details] [review]
patches/videoparsers: h264parser: more API fences and refresh

Add more API fences according with its version and refresh the patch.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Comment 16 Víctor Manuel Jáquez Leal 2015-09-14 18:09:48 UTC
Created attachment 311306 [details] [review]
patches/videoparsers: h265parser: rename patch keeping number

Refresh the patch and rename it in order to keep the patch number.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Comment 17 Víctor Manuel Jáquez Leal 2015-09-14 18:09:54 UTC
Created attachment 311307 [details] [review]
patches/videoparsers: h265parser: more API fences

Add more API fences according with its version and refresh the patch.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Comment 18 sreerenj 2015-09-15 08:31:59 UTC
Review of attachment 311305 [details] [review]:

There are some whitespace issues...
Comment 19 sreerenj 2015-09-15 08:32:17 UTC
Review of attachment 311306 [details] [review]:

There are some whitespace issues...
Comment 20 sreerenj 2015-09-15 08:32:37 UTC
Review of attachment 311307 [details] [review]:

There are some whitespace issues...
Comment 21 sreerenj 2015-09-15 08:36:54 UTC
Review of attachment 311302 [details] [review]:

The codecparser  has the code for initializing the slice_group_id, but not at the beginning of parsing..
IMHO, It could be more correct to fix it in parser...
Comment 22 sreerenj 2015-09-15 08:45:00 UTC
Review of attachment 311301 [details] [review]:

Does it intended to fix the issue http://lists.freedesktop.org/archives/gstreamer-devel/2015-September/054341.html ?

Not fixing the issue for me when building against 1.6 with --enable-builtin-codecparsers=no !
Comment 23 sreerenj 2015-09-15 08:46:59 UTC
Review of attachment 311303 [details] [review]:

lgtm
Comment 24 sreerenj 2015-09-15 08:47:21 UTC
Review of attachment 311304 [details] [review]:

lgtm,
Comment 25 sreerenj 2015-09-15 11:18:57 UTC
(In reply to sreerenj from comment #21)
> Review of attachment 311302 [details] [review] [review]:
> 
> The codecparser  has the code for initializing the slice_group_id, but not
> at the beginning of parsing..
> IMHO, It could be more correct to fix it in parser...

May be you can fix this in gstremaer-vaapi itself (as exactly in your patch) for now, and after 0.6.1 release fix it in codecparser so that you can avoid codecparser update for the bug fix release...
Comment 26 Víctor Manuel Jáquez Leal 2015-09-15 11:23:59 UTC
(In reply to sreerenj from comment #25)
> (In reply to sreerenj from comment #21)
> > Review of attachment 311302 [details] [review] [review] [review]:
> > 
> > The codecparser  has the code for initializing the slice_group_id, but not
> > at the beginning of parsing..
> > IMHO, It could be more correct to fix it in parser...
> 
> May be you can fix this in gstremaer-vaapi itself (as exactly in your patch)
> for now, and after 0.6.1 release fix it in codecparser so that you can avoid
> codecparser update for the bug fix release...

I was thinking exactly that. But still I need to open a bug to codecparsers.
Comment 27 Víctor Manuel Jáquez Leal 2015-09-15 17:52:31 UTC
Created attachment 311395 [details] [review]
decoder: h264: initialize PPS's slice_group_id

When the GstVaapiParserInfoH264 is allocated, the memory is not initialized,
so it contains random data.

When gst_h264_parser_parse_pps() fails, the PPS structure keeps slice_group_id
pointer uninitialized, leading to a segmentation fault when the memory is
freed.

This patch prevents this by initializing the slice_group_id before the PPS
parsing.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Comment 28 Víctor Manuel Jáquez Leal 2015-09-15 17:52:37 UTC
Created attachment 311396 [details] [review]
build: verify for H264 MVC and H265 SPS

Currently the H264 and H265 parsers look for MVC and SPS respectively, and
the required symbols for those were added in GStreamer 1.5

If we try to compile in GStreamer < 1.4, without enabling the builtin codec
parsers, the compilation fails, because the lack of those symbols.

This patch verifies if the installed H264 and H265 parsers have those symbols. If
they do not, the specific built in codec parsers are enabled and used.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Comment 29 Víctor Manuel Jáquez Leal 2015-09-15 17:52:43 UTC
Created attachment 311397 [details] [review]
build: link libgstvaapi_parse against codec parser

GST_CODEC_PARSER_* variables are defined if builtin codec parsers are disabled
when running configure.

Right now, libgstcodecparsers links only to libgstvaapi, but libgstvaapi_parse
need it if builtin codec parsers are disabled.

This patch adds GST_CODEC_PARSER_* variables to libgstvaapi_parse
compilation. If builtin codec parsers are enable, this variable is null, so it
should work using libgstvaapi, as normal.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Comment 30 Víctor Manuel Jáquez Leal 2015-09-15 17:52:49 UTC
Created attachment 311398 [details] [review]
patches/videoparsers: h264parser: refresh patches

In order to avoid the creation of .orig files and break the distcheck target.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Comment 31 Víctor Manuel Jáquez Leal 2015-09-15 17:52:55 UTC
Created attachment 311399 [details] [review]
patches/videoparsers: h264parser: fix description and refresh

Fix a typo in the patch description and refresh it in order to avoid the
creation of .orig files and break the distcheck target.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Comment 32 Víctor Manuel Jáquez Leal 2015-09-15 17:53:02 UTC
Created attachment 311400 [details] [review]
patches/videoparsers: h264parser: more API fences and refresh

Add more API fences according with its version and refresh the patch.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Comment 33 Víctor Manuel Jáquez Leal 2015-09-15 17:53:08 UTC
Created attachment 311401 [details] [review]
patches/videoparsers: h265parser: rename patch keeping number

Refresh the patch and rename it in order to keep the patch number.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Comment 34 Víctor Manuel Jáquez Leal 2015-09-15 17:53:14 UTC
Created attachment 311402 [details] [review]
patches/videoparsers: h265parser: more API fences

Add more API fences according with its version and refresh the patch.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
Comment 35 sreerenj 2015-09-16 07:30:28 UTC
I haven't tested myself (hope you done all necessary testing), but all patches LGTM ....
Comment 36 Víctor Manuel Jáquez Leal 2015-09-16 11:35:00 UTC
Attachment 311395 [details] pushed as f6ae00a - decoder: h264: initialize PPS's slice_group_id
Attachment 311396 [details] pushed as ccc9ce7 - build: verify for H264 MVC and H265 SPS
Attachment 311397 [details] pushed as 2aaafe9 - build: link libgstvaapi_parse against codec parser
Attachment 311398 [details] pushed as ac43e1c - patches/videoparsers: h264parser: refresh patches
Attachment 311399 [details] pushed as 0ec0dab - patches/videoparsers: h264parser: fix description and refresh
Attachment 311400 [details] pushed as ad463c8 - patches/videoparsers: h264parser: more API fences and refresh
Attachment 311401 [details] pushed as 5524af5 - patches/videoparsers: h265parser: rename patch keeping number
Attachment 311402 [details] pushed as d20ae26 - patches/videoparsers: h265parser: more API fences
Comment 37 Víctor Manuel Jáquez Leal 2015-09-17 11:26:42 UTC
(In reply to sreerenj from comment #25)
> (In reply to sreerenj from comment #21)
> > Review of attachment 311302 [details] [review] [review] [review]:
> > 
> > The codecparser  has the code for initializing the slice_group_id, but not
> > at the beginning of parsing..
> > IMHO, It could be more correct to fix it in parser...
> 
> May be you can fix this in gstremaer-vaapi itself (as exactly in your patch)
> for now, and after 0.6.1 release fix it in codecparser so that you can avoid
> codecparser update for the bug fix release...

I think that the h264 codec parser doesn't need to be fixed. The function that fills the structure GstH264PPS is 

gst_h264_parser_parse_pps ()

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-libs/html/gst-plugins-bad-libs-h264parser.html#gst-h264-parser-parse-pps

And it receives, as parameter, the instance of GstH264PPS. It is not the obligation of the callee to initialize the structure, but the obligation of the caller, if I understand correctly.
Comment 38 sreerenj 2015-09-17 11:45:34 UTC
(In reply to Víctor Manuel Jáquez Leal from comment #37)
> (In reply to sreerenj from comment #25)
> > (In reply to sreerenj from comment #21)
> > > Review of attachment 311302 [details] [review] [review] [review] [review]:
> > > 
> > > The codecparser  has the code for initializing the slice_group_id, but not
> > > at the beginning of parsing..
> > > IMHO, It could be more correct to fix it in parser...
> > 
> > May be you can fix this in gstremaer-vaapi itself (as exactly in your patch)
> > for now, and after 0.6.1 release fix it in codecparser so that you can avoid
> > codecparser update for the bug fix release...
> 
> I think that the h264 codec parser doesn't need to be fixed. The function
> that fills the structure GstH264PPS is 
> 
> gst_h264_parser_parse_pps ()
> 
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-bad-
> libs/html/gst-plugins-bad-libs-h264parser.html#gst-h264-parser-parse-pps
> 
> And it receives, as parameter, the instance of GstH264PPS. It is not the
> obligation of the callee to initialize the structure, but the obligation of
> the caller, if I understand correctly.

I wound't expect the user of API to fill the fields before calling the API.. :)
Especially the number of fields in the struct is too much...
We are creating the memory for slice_group_id() only when needed inside the API implementation. So I think is always better to move 
"
/* set default values for fields that might not be present in the bitstream
     and have valid defaults */
  pps->slice_group_id = NULL;
"
this part to the beginning of parser api.
Comment 39 Víctor Manuel Jáquez Leal 2015-09-17 13:41:55 UTC
(In reply to sreerenj from comment #38)
> I wound't expect the user of API to fill the fields before calling the API..
> :)
> Especially the number of fields in the struct is too much...
> We are creating the memory for slice_group_id() only when needed inside the
> API implementation. So I think is always better to move 
> "
> /* set default values for fields that might not be present in the bitstream
>      and have valid defaults */
>   pps->slice_group_id = NULL;
> "
> this part to the beginning of parser api.

You have convinced me. Let's see if we can convince upstream:

https://bugzilla.gnome.org/show_bug.cgi?id=755161