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 640211 - oggmux: ensure serialnos are unique
oggmux: ensure serialnos are unique
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
unspecified
Other All
: Normal normal
: 0.10.33
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-01-21 18:12 UTC by Vincent Penquerc'h
Modified: 2011-02-03 09:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
oggmux: ensure serialnos are unique (1.97 KB, patch)
2011-01-21 18:12 UTC, Vincent Penquerc'h
needs-work Details | Review
oggmux: ensure serialnos are unique (1.78 KB, patch)
2011-01-24 21:29 UTC, Vincent Penquerc'h
committed Details | Review
oggmux: ensure serialnos are unique (1.77 KB, patch)
2011-01-25 18:45 UTC, Vincent Penquerc'h
none Details | Review

Description Vincent Penquerc'h 2011-01-21 18:12:15 UTC
We do that by checking a newly generated one is not already used in
an existing stream, and doing it again if it is.
Comment 1 Vincent Penquerc'h 2011-01-21 18:12:17 UTC
Created attachment 178983 [details] [review]
oggmux: ensure serialnos are unique
Comment 2 Sebastian Dröge (slomo) 2011-01-24 19:00:17 UTC
Instead of using rand() (only returns values between 0 and RAND_MAX) here it would be better to use g_random_int() and you could simply have an while(present) loop over the random numbers, it's extremely unlikely that this never finishes.
Comment 3 Vincent Penquerc'h 2011-01-24 21:29:53 UTC
Created attachment 179232 [details] [review]
oggmux: ensure serialnos are unique

We do that by checking a newly generated one is not already used in
an existing stream, and doing it again if it is.

Now using g_random_int and removing the safety code.
Comment 4 Tim-Philipp Müller 2011-01-25 13:50:06 UTC
This patch seems to depend on other oggmux modifications (pad->map)
Comment 5 Vincent Penquerc'h 2011-01-25 14:14:08 UTC
Ah, yes:
http://bugzilla-attachments.gnome.org/attachment.cgi?id=178948
found in:
https://bugzilla.gnome.org/show_bug.cgi?id=629196

Note there are two patches in that bug.
Do you want to review/commit these first, or should I post another patch based on a clean -base ?
Comment 6 Vincent Penquerc'h 2011-01-25 18:45:24 UTC
Created attachment 179308 [details] [review]
oggmux: ensure serialnos are unique

We do that by checking a newly generated one is not already used in
an existing stream, and doing it again if it is.

A version that does not need my previous patches to oggmux.
Comment 7 Tim-Philipp Müller 2011-02-03 09:35:13 UTC
Thanks, committed:

 commit 96a1a9dec6676826dd808d6c35a5ae3f7f276212
 Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
 Date:   Fri Jan 21 18:10:29 2011 +0000

    oggmux: ensure serialnos are unique
    
    We do that by checking a newly generated one is not already used in
    an existing stream, and doing it again if it is.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=640211


I did one small change:

 - serialno = g_random_int();
 +serialno = g_random_int_range (0, G_MAXINT32);

to avoid pads named like 'sink_-418411', which is a bit awkward (generally the ogg code seems to be a bit confused about the type and sign of the serial number, and GStreamer about it's pad templates, using sink_%d when it really wants sink_%u)