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 766803 - h264parse: add support for config-interval=-1 to re-send SPS/PPS on I/IDR frames
h264parse: add support for config-interval=-1 to re-send SPS/PPS on I/IDR frames
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.6.0
Other Linux
: Normal enhancement
: 1.9.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-05-23 13:49 UTC by Mats Lindestam
Modified: 2016-06-13 09:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Changed H.264 property config_interval to signed int (2.06 KB, patch)
2016-05-23 13:49 UTC, Mats Lindestam
none Details | Review
Add support for config-interval=-1 to re-send SPS/PPS on I/IDR frames (11.00 KB, patch)
2016-05-24 05:01 UTC, Mats Lindestam
none Details | Review
Support for signed config-interval property (2.05 KB, patch)
2016-05-25 11:04 UTC, Mats Lindestam
none Details | Review
Support for signed config-interval property (2.05 KB, patch)
2016-05-25 11:07 UTC, Mats Lindestam
none Details | Review
Refactored handling of SPS/PPS when pushing frames. (8.35 KB, patch)
2016-05-25 11:10 UTC, Mats Lindestam
none Details | Review
Support for handling of config-interval = -1. (2.00 KB, patch)
2016-05-25 11:10 UTC, Mats Lindestam
none Details | Review
h264parse: change "config-interval" property type from uint to int (2.18 KB, patch)
2016-06-09 12:30 UTC, Mats Lindestam
none Details | Review
h264parse: refactored handling of SPS/PPS when pushing frames (8.41 KB, patch)
2016-06-09 12:31 UTC, Mats Lindestam
none Details | Review
h264parse: support for handling of config-interval = -1 (2.06 KB, patch)
2016-06-09 12:32 UTC, Mats Lindestam
none Details | Review
h264parse: change "config-interval" property type from uint to int (2.18 KB, patch)
2016-06-13 06:58 UTC, Mats Lindestam
committed Details | Review
h264parse: refactored handling of SPS/PPS when pushing frames (8.55 KB, patch)
2016-06-13 06:59 UTC, Mats Lindestam
committed Details | Review
h264parse: support for handling of config-interval = -1 (2.06 KB, patch)
2016-06-13 07:00 UTC, Mats Lindestam
committed Details | Review

Description Mats Lindestam 2016-05-23 13:49:49 UTC
Created attachment 328393 [details] [review]
Changed H.264 property config_interval to signed int

To be able to use a negative value (-1) to In the represent sending SPS & PPS inband for each IDR frame we have channged the property "config-interval" from a unsigned int to an signed int.
Comment 1 Tim-Philipp Müller 2016-05-23 14:10:38 UTC
Let's retitle this to what you actually want to achieve, you can then attach the other patch here too :)
Comment 2 Mats Lindestam 2016-05-23 14:39:59 UTC
Sorry for being a bit densed. Should I change the commit-message? What do you want me to change it to, the same as the title of the bug?
Comment 3 Tim-Philipp Müller 2016-05-23 14:53:44 UTC
My understanding was that you wanted to add support for config-interval=-1 to h264parse, in the same way as rtph264pay.

This requires more than just changing the property from uint to int though, so I assumed there would be a follow-up patch that implements the support for config-interval=-1. That is the actual change, the uint->int change is just preparation as far as I can tell, no?
Comment 4 Mats Lindestam 2016-05-23 18:00:16 UTC
Sorry, now I see what you mean. 

I was not aware that the config-interval=-1 solution in rtph264pay was present in the upstream code. I thought that solution was Axis specific. My bad!

I will supply you with the rest of the h264parse equivalent config-interval=-1 code ASAP tomorrow. I'm a bit new to this. :-)
Comment 5 Mats Lindestam 2016-05-24 05:01:36 UTC
Created attachment 328417 [details] [review]
Add support for config-interval=-1 to re-send SPS/PPS on I/IDR frames

The full config-interval=-1 solution for h264parse.
Comment 6 Tim-Philipp Müller 2016-05-24 22:42:12 UTC
Comment on attachment 328417 [details] [review]
Add support for config-interval=-1 to re-send SPS/PPS on I/IDR frames

Thanks for the patch!

>+  } else if (h264parse->interval == -1) {
>+    if (h264parse->idr_pos >= 0) {
>+      GST_LOG_OBJECT (h264parse, "IDR nal at offset %d", h264parse->idr_pos);
>+
>+      gst_h264_parse_handle_sps_pps_nals (h264parse, buffer, frame);
>+
>+      /* we pushed whatever we had */
>+      h264parse->push_codec = FALSE;
>+      h264parse->have_sps = FALSE;
>+      h264parse->have_pps = FALSE;
>+      h264parse->state &= GST_H264_PARSE_STATE_VALID_PICTURE_HEADERS;
>+    }
>   }

Any reason this can't go as a simple || addition into the existing if/else branches? (Honest question, just curious to know if you've considered it and there's a reason or not).
Comment 7 Mats Lindestam 2016-05-25 06:23:48 UTC
Hi,

I did consider putting the (h264parse->interval == -1) option int the existing if/else. I guess I did that consideration before I added the gst_h264_parse_handle_sps_pps_nals help function, when there were a lot more code to take into account. Anyhow I ended up with this solution since I found it a bit cleaner. It doesn't bother with time-intervals at all. There are some duplication of code but I didn't think it was too much.

I guess I could check for (h264parse->interval == -1) twice and make the existing if/else work. Should I change it?
Comment 8 Tim-Philipp Müller 2016-05-25 08:57:49 UTC
No it's fine, just trying to understand.

Could you provide three separate patches please in this case:

 - one for the property type change (as attached already)
 - one for factoring out the sps/pps handling
 - one for adding the interval == -1 part
Comment 9 Mats Lindestam 2016-05-25 11:04:11 UTC
Created attachment 328491 [details] [review]
Support for signed  config-interval property
Comment 10 Mats Lindestam 2016-05-25 11:07:24 UTC
Created attachment 328493 [details] [review]
Support for signed  config-interval property
Comment 11 Mats Lindestam 2016-05-25 11:10:04 UTC
Created attachment 328502 [details] [review]
Refactored handling of SPS/PPS when pushing frames.
Comment 12 Mats Lindestam 2016-05-25 11:10:36 UTC
Created attachment 328503 [details] [review]
Support for handling of config-interval = -1.
Comment 13 Mats Lindestam 2016-05-25 11:11:53 UTC
Hi,

I hope this is ok. I removed the old patches and added the fix in three separate patches.
Comment 14 Tim-Philipp Müller 2016-06-09 11:51:29 UTC
Comment on attachment 328493 [details] [review]
Support for signed  config-interval property

This one looks fine, but please adjust the commit message:

> Support for signed  config-interval property

Should be something like:

> h264parse: change "config-interval" property type from uint to int
> 
> So we can use -1 as special value like in rtph264pay.
> 
> https://bugzilla.gnome.org/show_bug.cgi?id=766803
Comment 15 Tim-Philipp Müller 2016-06-09 12:01:50 UTC
Comment on attachment 328503 [details] [review]
Support for handling of config-interval = -1.

This one is fine, but please fix up the commit message (summary line, bug url).
Comment 16 Mats Lindestam 2016-06-09 12:30:15 UTC
Created attachment 329457 [details] [review]
h264parse: change "config-interval" property type from uint to int
Comment 17 Mats Lindestam 2016-06-09 12:31:17 UTC
Created attachment 329458 [details] [review]
h264parse: refactored handling of SPS/PPS when pushing frames
Comment 18 Mats Lindestam 2016-06-09 12:32:11 UTC
Created attachment 329459 [details] [review]
h264parse: support for handling of config-interval = -1
Comment 19 Tim-Philipp Müller 2016-06-09 12:35:27 UTC
Comment on attachment 329458 [details] [review]
h264parse: refactored handling of SPS/PPS when pushing frames

Here you have moved the

  h264parse->last_report = new_ts;

from the inner loop during the refactoring, and are now doing it unconditionally.

Someone needs to investigate if it matters or not.

I think it's a bit suspicious, I think we might be resetting the timer/counter even if we didn't send anything yet.

Perhaps it'd be better to make the new function return a boolean if it sent out stuff, and only reset the last_report time then?
Comment 20 Tim-Philipp Müller 2016-06-09 12:36:53 UTC
Comment on attachment 329457 [details] [review]
h264parse: change "config-interval" property type from uint to int

>Subject: [PATCH 1/3] h264rse: change "config-interval" property type from uint

Typo in summary, but we can fix this when we commit it.
Comment 21 Mats Lindestam 2016-06-09 12:53:10 UTC
(In reply to Tim-Philipp Müller from comment #19)
> Comment on attachment 329458 [details] [review] [review]
> h264parse: refactored handling of SPS/PPS when pushing frames
> 
> Here you have moved the
> 
>   h264parse->last_report = new_ts;
> 
> from the inner loop during the refactoring, and are now doing it
> unconditionally.
> 
> Someone needs to investigate if it matters or not.
> 
> I think it's a bit suspicious, I think we might be resetting the
> timer/counter even if we didn't send anything yet.
> 
> Perhaps it'd be better to make the new function return a boolean if it sent
> out stuff, and only reset the last_report time then?

You could add new_ts as an function parameter and set it as it was done before? I think I had it like that in an earlier version of the code. Don't know why I changed my mind.
Comment 22 Mats Lindestam 2016-06-13 06:58:53 UTC
Created attachment 329662 [details] [review]
h264parse: change "config-interval" property type from  uint to int
Comment 23 Mats Lindestam 2016-06-13 06:59:41 UTC
Created attachment 329663 [details] [review]
h264parse: refactored handling of SPS/PPS when pushing  frames
Comment 24 Mats Lindestam 2016-06-13 07:00:15 UTC
Created attachment 329664 [details] [review]
h264parse: support for handling of config-interval = -1
Comment 25 Tim-Philipp Müller 2016-06-13 09:13:10 UTC
Pushed, thanks!

commit a0876aa750797d9f171040d4736086fcfea55b91
Author: Mats Lindestam <matslm@axis.com>
Date:   Wed May 25 12:55:36 2016 +0200

    h264parse: support for handling of config-interval = -1
    
    Added support for handling of config-interval = -1.
    config-inteval = -1 represents resending SPS and PPS for each
    I-/IDR-frame.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=766803

commit bf0d952387e517c983fce44bcf129db87e8b3ea3
Author: Mats Lindestam <matslm@axis.com>
Date:   Wed May 25 12:45:17 2016 +0200

    h264parse: refactored handling of SPS/PPS when pushing frames
    
    https://bugzilla.gnome.org/show_bug.cgi?id=766803

commit 0c04e004bbd976c8c58b5b3528011e293bfaa34c
Author: Mats Lindestam <matslm@axis.com>
Date:   Wed May 25 11:54:55 2016 +0200

    h264parse: change "config-interval" property type from uint to int
    
    So we can use -1 as special value like in rtph264pay.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=766803