centricular / gstcefsrc

A simple gstreamer wrapper around Chromium Embedded Framework
86 stars 45 forks source link

Fix bad audio metadata (issues #73) #75

Closed SteveMcFarlin closed 1 year ago

SteveMcFarlin commented 1 year ago

It looks like issue #73 was never addressed. This PR has the suggested fix.

MathieuDuponchelle commented 1 year ago

lgtm thanks :)

heftig commented 1 year ago

Shouldn't this be using BPF instead of BPS?

SteveMcFarlin commented 1 year ago

@heftig I am not sure of the answer here. You might want to open an issue if you think BPF is the right choice.

MathieuDuponchelle commented 1 year ago

Why would BPF be correct here? The third parameter to gst_buffer_add_audio_meta is a number of samples no?

heftig commented 1 year ago

gst_buffer_add_audio_meta expects the number of samples in the buffer. The wording is a bit ambiguous, but the example given for non-interleaved layout makes it clear that the buffer size should be equal to channels * samples * sample_stride.

BPS produces the bytes per sample (the sample_stride), while BPF produces the bytes per frame (channels * sample_stride).

So in the case of a non-mono stream I'd expect the meta to still be broken.

MathieuDuponchelle commented 1 year ago

Please see my answer here