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 692045 - uvch264src: port to 1.0
uvch264src: port to 1.0
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal enhancement
: 1.1.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 678431 (view as bug list)
Depends on: 692042
Blocks:
 
 
Reported: 2013-01-18 23:34 UTC by Sjoerd Simons
Modified: 2013-02-21 20:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
basecamerabinsrc: Add auto-start property to basecamerabin (3.70 KB, patch)
2013-01-18 23:34 UTC, Sjoerd Simons
committed Details | Review

Description Sjoerd Simons 2013-01-18 23:34:26 UTC
See patchset :)
Comment 1 Sjoerd Simons 2013-01-18 23:34:52 UTC
Created attachment 233812 [details] [review]
basecamerabinsrc: Add auto-start property to
 basecamerabin
Comment 2 Sjoerd Simons 2013-01-18 23:38:51 UTC
Ugh, patchsets in bugzilla.. Branch here, much easier :):
  http://cgit.collabora.com/git/user/sjoerd/gst-plugins-bad.git/log/?h=uvch264

Requires the patch from #692042
Comment 3 Olivier Crête 2013-01-19 01:25:43 UTC
You removed image/jpeg from the caps.

Any reason you use gst_memory_copy() instead of gst_memory_shared() in the mjpeg demuxer ?

I don't think droping segment events is required anymore.

In the src, you replaced gst_pad_fixate_caps(), with gst_caps_fixate().. v4l2src actually has code in there, so it may make more sense to call gst_base_src_fixate(v4l2src, caps);

The getcaps query handling should pass the filter caps around.
Comment 4 Tim-Philipp Müller 2013-01-23 12:38:29 UTC
*** Bug 678431 has been marked as a duplicate of this bug. ***
Comment 5 Youness Alaoui 2013-01-24 02:40:55 UTC
Thanks Sjoerd and great job! :)
Couple of comments :
- I noticed a bug in the code, the 'nv12' pad has format=NV21 instead of NV12 (same on 0.10 branch)
- The VF_CAPS also had image/jpeg which I don't think are in GST_VIDEO_FORMATS_ALL (so VID_CAPS also will be missing it)
- In gst_uvc_h264_src_fixate_caps, why did you remove the gst_caps_unref(tcaps) ?
- Same comment as Olivier about the gst_pad_fixate_caps
- I didn't look at the changed in the mjpeg_demux_chain cause it looks scary :)
- The custom_upstream "renegotiate" event handling should be removed and replaced with handling the reconfigure event (or is that automatic?).

- In tests/examples/uvch264/window.glade, you forgot to change (fourcc) into (string) for the caps.
- In http://cgit.collabora.com/git/user/sjoerd/gst-plugins-bad.git/commit/?h=uvch264&id=d9c64a61634070d50314bf61c6018c965ea97f0b you changed the section name but didn't change it in the docs/ file so it gets picked up by gtk-doc.

That's about it from my side, but this is my first 1.0 code that I've looked at so I might not be as qualified.

There is also a couple of bugfixes I've done recently on the 0.10 branch : http://cgit.collabora.com/git/user/kakaroto/gst-plugins-bad.git/log/?h=0.10
You can ignore the PropertyProbe patch (until we have an equivalent for 1.0), but there were a couple of bugs in transform_caps and handling of the caps ref that might need porting to the 1.0 code.

Thanks!
Comment 6 Sjoerd Simons 2013-02-02 13:14:43 UTC
(In reply to comment #3)
> You removed image/jpeg from the caps.
> 
> Any reason you use gst_memory_copy() instead of gst_memory_shared() in the
> mjpeg demuxer ?

gst_memory_shared asserts the GstMemory doens't have GST_MEMORY_FLAG_NO_SHARE,, which v4l2src sets.. So sharing isn't possible in practise here.

In theory sharing if possible would be nice (ideally gst should get some api to do this)

> I don't think droping segment events is required anymore.

I'm not entirely sure about the segment handling, so i left it as is.. Youness might be able to clarify what it's necessary in 0.10
 
> In the src, you replaced gst_pad_fixate_caps(), with gst_caps_fixate()..
> v4l2src actually has code in there, so it may make more sense to call
> gst_base_src_fixate(v4l2src, caps);

Maybe, but that's not public api currently (and i don't think banging on the vmethod by hand is very nice :))

Ideally one might at some point want to merge the v4l specific bits into v4l2src such that the bin doesn't have to bang ioctls on the device behind v4l2src back (and merge the caps negotiation back into v4l2src as well) 

> The getcaps query handling should pass the filter caps around.

fixed in the git branch. Not tested as i don't have the camera with me :)
Comment 7 Sjoerd Simons 2013-02-03 11:43:50 UTC
(In reply to comment #5)
> Thanks Sjoerd and great job! :)
> Couple of comments :
> - I noticed a bug in the code, the 'nv12' pad has format=NV21 instead of NV12
> (same on 0.10 branch)

Fixed

> - The VF_CAPS also had image/jpeg which I don't think are in
> GST_VIDEO_FORMATS_ALL (so VID_CAPS also will be missing it)

fixed

> - In gst_uvc_h264_src_fixate_caps, why did you remove the gst_caps_unref(tcaps)
> ?

gst_caps_normalize takes ownership in 1.0

> - Same comment as Olivier about the gst_pad_fixate_caps

See my reply there :)

> - I didn't look at the changed in the mjpeg_demux_chain cause it looks scary :)

heh, it's fine don't worry.. :p

> - The custom_upstream "renegotiate" event handling should be removed and
> replaced with handling the reconfigure event (or is that automatic?).

Removed that code (nothing send the event atm). Making sure uvch264 renegotiates correctly is something todo, but given v4l2src can't renegotiate properly atm it's a tad moot

> - In tests/examples/uvch264/window.glade, you forgot to change (fourcc) into
> (string) for the caps.
fixed

> - In
> http://cgit.collabora.com/git/user/sjoerd/gst-plugins-bad.git/commit/?h=uvch264&id=d9c64a61634070d50314bf61c6018c965ea97f0b
> you changed the section name but didn't change it in the docs/ file so it gets
> picked up by gtk-doc.
> 
> That's about it from my side, but this is my first 1.0 code that I've looked at
> so I might not be as qualified.

You had some good catches so i guess you are :)

> 
> There is also a couple of bugfixes I've done recently on the 0.10 branch :
> http://cgit.collabora.com/git/user/kakaroto/gst-plugins-bad.git/log/?h=0.10
> You can ignore the PropertyProbe patch (until we have an equivalent for 1.0),
> but there were a couple of bugs in transform_caps and handling of the caps ref
> that might need porting to the 1.0 code.

From just a quick skim it looks like it's only the refcounting bug that isn't pulled in yet (which changed in 1.0, but i should doublecheck if it's correct there).  or did i miss something?
Comment 8 Youness Alaoui 2013-02-05 23:46:10 UTC
(In reply to comment #7)
> > - In gst_uvc_h264_src_fixate_caps, why did you remove the gst_caps_unref(tcaps)
> > ?
> 
> gst_caps_normalize takes ownership in 1.0
> 
oh ok, a change in behavior. Thanks.

> > - Same comment as Olivier about the gst_pad_fixate_caps
> 
> See my reply there :)
I'm not exactly sure what it does differntly. It's probably just more optimized or something, but it should still work the same in the end. Would need testing.

> 
> > - The custom_upstream "renegotiate" event handling should be removed and
> > replaced with handling the reconfigure event (or is that automatic?).
> 
> Removed that code (nothing send the event atm). Making sure uvch264
> renegotiates correctly is something todo, but given v4l2src can't renegotiate
> properly atm it's a tad moot
Ah, I didn't notice it being removed from the diff, maybe I just missed it.
As for renegotiation, although there is a RESET ioctl for the h264 encoder, it doesn't seem to work for the C920, so either way, renegotiation forces me to put v4l2src to state READY and back to PLAYING, this means that even if v4l2src can't renegotiate at the moment, uvch264_src should still be able to achieve it.

> 
> > 
> > There is also a couple of bugfixes I've done recently on the 0.10 branch :
> > http://cgit.collabora.com/git/user/kakaroto/gst-plugins-bad.git/log/?h=0.10
> > You can ignore the PropertyProbe patch (until we have an equivalent for 1.0),
> > but there were a couple of bugs in transform_caps and handling of the caps ref
> > that might need porting to the 1.0 code.
> 
> From just a quick skim it looks like it's only the refcounting bug that isn't
> pulled in yet (which changed in 1.0, but i should doublecheck if it's correct
> there).  or did i miss something?
Yes, there was a refcounting issue in the case an error occurs, but also, I had to add a fakesink to that transform_caps otherwise basetransform returns the pad templates if it sees there's nothing linked on the other side of the colorspace. I don't know how that works in 1.0 though.


> I'm not entirely sure about the segment handling, so i left it as is.. Youness
> might be able to clarify what it's necessary in 0.10
The reason for segment handling is that when we renegotiate, we drop the EOS that's being sent when we pull v4l2src to state READY, and we put it back to PLAYING, it sends another new-segment which needs to be dropped (otherwise you get accumulation and whatever, and it screws everything up). I believe there's no more accumulation of segments in 1.0, in that case, that code might not be needed anymore, but again without testing we can't know for sure.
I don't have the hardware anymore (sent for a demo to the CES conference), so I can't test this myself now. I might request new cameras so I can keep maintaining the element.
Comment 9 Tim-Philipp Müller 2013-02-17 23:50:29 UTC
This has landed in master now. Can the bug be closed, or are there outstanding issues? If there are outstanding issues, perhaps new bugs should be filed for them for clarity?
Comment 10 Youness Alaoui 2013-02-21 19:48:56 UTC
I agree, since this has been ported and merged, I suggest we close the bug. I believe Sjoerd fixed everything we said from the code review, and any issues will be found now only by testing (wish I still had the hardware). Any new issues can have a new bug opened for them.
Thanks Sjoerd for the work!
Comment 11 Tim-Philipp Müller 2013-02-21 19:56:40 UTC
Cool, thanks everyone!
Comment 12 Tim-Philipp Müller 2013-02-21 20:00:49 UTC
Comment on attachment 233812 [details] [review]
basecamerabinsrc: Add auto-start property to
 basecamerabin

commit 381fcda68b079b59f6d68b4f47f24e4885d592ba
Author: Youness Alaoui <youness.alaoui@collabora.co.uk>
Date:   Thu May 3 20:36:27 2012 -0400

    basecamerabinsrc: Add auto-start property to basecamerabin