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 708345 - liveadder: round when calculation length from duration
liveadder: round when calculation length from duration
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 1.3.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-09-19 06:48 UTC by Michael Olbrich
Modified: 2013-09-28 11:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (1.54 KB, patch)
2013-09-19 06:48 UTC, Michael Olbrich
committed Details | Review

Description Michael Olbrich 2013-09-19 06:48:08 UTC
Created attachment 255272 [details] [review]
patch

liveadder sometimes calculates the offsets incorrectly before adding. The 
resulting errors can easily be heard when mixing silence with a sine. 
I'm not sure what the exact conditions are to trigger this, but it definitively
happens when the buffers of two streams have a different duration and buffer
length and duration don't match exactly for one stream because of rounding
errors (e.g.  duration=0:00:00.021333333)

I have to admit, I got lost in the math somewhere but it seems that not 
rounding in gst_live_adder_length_from_duration() causes 1 sample overlaps in
consecutive buffers from the same stream.
When using gst_util_uint64_scale_int_round() instead of just truncating the 
sine sound correctly again.
Comment 1 Sebastian Dröge (slomo) 2013-09-28 11:31:48 UTC
commit 93ec45a6dfaa9fb0047742fb85314c4946b35070
Author: Michael Olbrich <m.olbrich@pengutronix.de>
Date:   Wed Sep 18 17:51:26 2013 +0200

    liveadder: round when calculation length from duration
    
    liveadder sometimes calculates the offsets incorrectly before adding. The
    resulting errors can easily be heard when mixing silence with a sine.
    I'm not sure what the exact conditions are to trigger this, but it definitively
    happens when the buffers of two streams have a different duration and buffer
    length and duration don't match exactly for one stream because of rounding
    errors (e.g.  duration=0:00:00.021333333)
    
    I have to admit, I got lost in the math somewhere but it seems that not
    rounding in gst_live_adder_length_from_duration() causes 1 sample overlaps in
    consecutive buffers from the same stream.
    When using gst_util_uint64_scale_int_round() instead of just truncating the
    sine sound correctly again.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708345