flacdec converts the src timestamp to a sample number, uses that internally, then reconverts the sample number to a timestamp for the output buffer. Unfortunately, sample numbers can't be represented in an integer number of nanoseconds, and the conversion process was truncating rather than rounding, resulting in sample numbers and output timestamps that were often off by a full sample.
This corrects the time->sample convesion
There's no use in splitting the incoming data down to the segsize
limit - by writing as much as possible in one chunk, we increase
performance and avoid PulseAudio unnecessary rewinds.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
The libFLAC API is callback based, and we must only call it to
output data when we know we have enough input data. For this
reason, a single processing step is done when receiving a buffer.
However, if there were metadata buffers still pending, a step
intended for the first audio frame might end up writing that
leftover metadata. Since a single step is done per buffer, this
will cause every buffer to be written one step late.
This would add some latency (a bufferfull's worth), possibly
lose a buffer when seeking or the like, and also cause timestamp
and offset to be applied to the wrong buffer, as updates to
the "current" segment last_stop (from incoming buffer timestamp)
will be applied to an output buffer originating from the previous
incoming buffer.
This fixes the issue by ensuring that, upon receiving the first
audio frame, processing is done till all metadata is processed,
so the next "single step" done will be for the audio frame. After
this, we should keep to 1 input buffer -> 1 output buffer and so
avoid getting out of sync.
https://bugzilla.gnome.org/show_bug.cgi?id=650960
This adds support for various compressed formats (AC3, E-AC3, DTS and
MP3) payloaded in IEC 61937 format (used for transmission over S/PDIF,
HDMI and Bluetooth).
The acceptcaps() function allows bins to probe for what formats the sink
being connected to support. This only works after the element is set to
at least READY.
If the underlying sink changes and the format we are streaming is not
available, we emit a message that will allow upstream elements/bins to
block and renegotiate a new format.
This exposes the source output index of the record stream that we open
so that clients can use this with the introspection if they want (to
move the stream, for example).
Since commit 8bfd80, gst_pulseringbuffer_stop doesn't wait for the
deferred call to be run before returning. This causes a race when
READY->NULL is executed shortly after, which stops the mainloop. This
leaks the element reference which is passed as userdata for the callback
(introduced in commit 7cf996, bug #614765).
The correct fix is to wait in READY->NULL for all outstanding calls to
be fired (since libpulse doesn't provide a DestroyNotify for the
userdata). We get rid of the reference passing from 7cf996 altogether,
since finalization from the callback would anyways lead to a deadlock.
Re-fixes bug #614765.
So that pulsesrc/pulsesink get chosen over other possible PRIMARY
src/sinks by autoaudiosink. Presumably, if pulse is available, it
is always preferred over another src/sink.
Fixes: #647540.
For some reason, in code dating to 2001, encoded jpeg buffers were
rounded up to multiples of 4 bytes. With the added bonus that the
extra bytes are unwritten, causing valgrind issues. Oops. I can't
think of any reason why JPEG buffers need to be multiples of 4 bytes,
so I removed the padding. There might be some code somewhere that
depends on this behavior, so if this needs to be reverted, please fix
the valgrind issues.
This drops support fof PulseAudio versions prior to 0.9.16, which was
released about 1.5 years ago. Testing with very old versions is not
feasible and we don't want to maintain 2 independent code-paths.
Not doing so will cause buffers to be received by downstream without
a time base set.
We use the same method avimux uses to get access to the event when
collectpads got the sink event function.
https://bugzilla.gnome.org/show_bug.cgi?id=640323
Don't use g_assert() for error handling, even if they're highly unlikely.
Either we *know* that something can't happen, in which case we
should just not handle it, or we think something can happen, but it is
very very unlikely that it will ever happen, in which case we should
handle it like any other error instead of asserting.
g_assert() is best left for conditions we have control of, like checking
internal consistency of our code, not checking return values of external
code.
Fixes a bunch of warnings when compiling with -DG_DISABLE_ASSERT:
gstrtpgsmpay.c: In function 'gst_rtp_gsm_pay_handle_buffer':
gstrtpgsmpay.c:130:17: warning: variable 'rtpgsmpay' set but not used
gstspeexenc.c: In function 'gst_speex_enc_encode':
gstspeexenc.c:904:19: warning: variable 'written' set but not used
pulsesink.c: In function 'gst_pulsesink_change_state':
pulsesink.c:2725:9: warning: variable 'res' set but not used
pulsesrc.c: In function 'gst_pulsesrc_change_state':
pulsesrc.c:1253:7: warning: variable 'e' set but not used
GCC 4.6.x spits warnings about such usage of variables. The variables in
raw1394 were marked with G_GNUC_UNUSED as this seemed omre appropriate.
The others were removed.
Instead only store them inside the flac metadata. There's
no point in storing them twice and the flac metadata is
still the official way to store image tags inside flac.
Speex has build in silence detection. If speex_encode_int returns 0,
than there is silence and sample do not need to be transmitted.
This work only if vbr=1 and dtx=1 optionas are enabled.
So if we get 0, we add GAP flag to the sample.
Pulsesink was recently changed to defer uncorking until there is data
to write. This condition will however never occur when EOS in being
rendered (since that marks the end of data). Changing to PAUSED state
while EOS is being waited on results in a hang: pausing corks the
stream, which will never be undone since there is no more data when
going back to PLAYING. If pulsesink is the clock provider, deadlock
ensues since time doesn't continue in corked state and the clock id
for EOS wait never fires.
Fixes#645961.
If we did not know how many frames to expect, then we get an unexpected
end of stream when trying to decode more frames that are there, if there
are leftover bits to pad to the next byte
Looking at the remaining bits in the bitstream after decoding a
single frame can't be used as loop condition. The remaining
bits might not give a complete frame and the speex decoder will
then output nothing but access uninitialized memory, which leads
to valgrind warnings.
Fixes bug #644669.
Allows applications to connect to the "draw" signal of
the element and do their custom drawing there.
Includes an example application demonstrating usage.
Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=595520
Not doing so can result in a deadlock when two threads enter
gst_pulseringbuffer_open_device at the same time, as
pa_threaded_mainloop_wait releases the mainloop lock while waiting,
allowing another thread to take it, resulting in a deadlock as two
threads waits for the lock the other is holding.
https://bugzilla.gnome.org/show_bug.cgi?id=643087
By allowing larger chunks to be sent, PulseAudio will have a
lower CPU usage. This is especially important on low-end machines,
where PulseAudio can crash if packets are coming in at a higher
rate than PulseAudio can process them.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
After starting the ringbuffer, we wait for enough data to arrive before
uncorking the stream. This will cause the pipeline to stall if we get an
EOS (or otherwise need to flush the stream) before sufficient data
becomes available. This patch makes sure that the stream is uncorked
while flushing to avoid this problem.
Fixes issue with a webkit unit test testing reverse playback of
an MP4 H.264/AAC file.
https://bugzilla.gnome.org/show_bug.cgi?id=639740
This makes the call to pa_stream_cork() during ringbuffer pause()
synchronous, which makes sure that the clock does not advance after we
take a snapshot for start_time.
https://bugzilla.gnome.org/show_bug.cgi?id=639240
Error out when we are asked to read a different size that what was configured as
the jack period size because that would mean something else is wrong.
Fixes#618409
Not only adjust buffer-time and avoid segtotal=0, but instead ensure segtotal is
atleast 2. Do same change on jacksrc. We could also check the latency and buffer
time configured by the client and adjust buffer-time so that we get to the same
number of segments.
Jack overrides user-specified latency-time with the one it gets from jack
itself. It also needs to adjust buffer-time somewhat to avoid segtotal being 0
The gst_jack_audio_client_set_active() flags the port as deactivating and uses
a GCond to wait until the jack_process_cb() has run once more and cleared the
flag. This way the client zero's the buffer. This happens if one manyally go
to PAUSED and then to READY, while leting the mainloop run inbetween.
Add a new connection mode to jacksrc and jacksink. In this new auto-force
connection mode jack will create as many ports as requested/needed in the
pipeline and will then connect as many physical ports as possible, possibly
leaving some ports unconnected.
Also get rid of some leftover g_print.
Fixes#575284.
Original commit message from CVS:
* ext/jack/gstjackaudiosink.c:
* ext/jack/gstjackaudiosrc.c:
Query port latencies for sink/src delays.
* ext/jack/gstjackbin.c:
No printf please.