| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
The return value of audio_linear_dither() is always casted to
mpd_sint16. Returning long does not make sense, and consumed 8 bytes
on a 64 bit platform.
|
|
|
|
|
| |
The output buffer always contains mpd_sint16; declaring it with that
type saves several casts.
|
|
|
|
|
| |
The previous patch removed all loop specific dependencies from the
num_samples formula; we can now calculate it before entering the loop.
|
|
|
|
|
|
| |
The output buffer is always flushed after being appended to, which
allows us to assume it is always empty. Always start writing at
outputBuffer, don't remember outputPtr.
|
|
|
|
|
|
| |
The previous patch made mp3Read() flush the output buffer in every
iteration, which means we can eliminate the flush check after invoking
mp3Read().
|
|
|
|
|
| |
Since we try to fill the buffer in every iteration, we assume that we
should flush the output buffer at the end of each iteration.
|
|
|
|
|
|
| |
Fill the whole output buffer at a time by using dither_buffer()'s
ability to decode blocks. Calculate how many samples fit into the
output buffer before each invocation.
|
|
|
|
|
|
|
| |
Simplifying loops for performance: why check dropSamplesAtEnd in every
iteration, when we could modify the loop boundary? The (writable)
variable samplesLeft can be eliminated; add a write-once variable
pcm_length instead, which is used for the loop condition.
|
|
|
|
|
|
| |
The variable samplesPerFrame is used only in one single closure. Make
it local to this closure. The compiler will probably convert it to a
register anyway.
|
| |
|
|
|
|
|
|
|
|
| |
Preparing for simplifying and thus speeding up the dithering code:
moved dithering to a separate function which contains a trivial loop.
With this patch, only one sample is dithered at a time, but the
following patches will allow us to dither a whole block at a time,
without complicated buffer length checks.
|
|
|
|
|
| |
Performance improvement by moving stuff out of a loop: skip part of
the first frame before entering the loop.
|
| |
|
|
|
|
|
|
| |
Copy some code from aac_decode() to aac_stream_decode() and apply
necessary changes to allow streaming audio data. Both functions might
be merged later.
|
|
|
|
|
|
|
| |
initAacBuffer() should really only initialize the buffer; currently,
it also reads data from the input stream and parses the header. All
of the AAC buffer code should probably be moved to a separate library
anyway.
|
|
|
|
|
| |
The AAC plugin sometimes does not check the length of available data
when checking for magic prefixes. Add length checks.
|
|
|
|
| |
Eliminate some duplicated code by using fillAacBuffer().
|
|
|
|
|
| |
Find AAC frames in the input and skip invalid data. This prepares AAC
streaming.
|
|
|
|
|
| |
adts_check_frame() checks whether the buffer head is an AAC frame, and
returns the frame length.
|
|
|
|
|
|
| |
Shifting from the buffer queue is a common operation, and should be
provided as a separate function. Move code to aac_buffer_shift() and
add a bunch of assertions.
|
|
|
|
|
|
|
|
|
| |
When checking for EOF, we should not check whether the read request
has been fully satisified. The InputStream API does not guarantee
that readFromInputStream() always fills the whole buffer, if EOF is
not reached. Since there is the function inputStreamAtEOF() dedicated
for this purpose, we should use it for EOF checking after
readFromInputStream()==0.
|
|
|
|
|
|
| |
Fill the AacBuffer even when nothing has been consumed yet. The
function should not check for consumed data, but for free space at the
end of the buffer.
|
|
|
|
|
| |
Return instead of putting all the code into a if-closure. That saves
one level of indentation.
|
|
|
|
|
| |
adtsParse() always returns 1, and its caller does not use the return
value.
|
| |
|
|
|
|
|
| |
Since we eliminated the parameters retFileread and retTagsize in all
callers, we can now safely remove it from the function prototype.
|
| |
|
|
|
|
|
| |
Make the code more readable by hiding big formulas in an inline
function with a nice name.
|
|
|
|
|
| |
Don't use CPP macros when you can use C enum... this also allows
better type checking.
|
|
|
|
|
| |
We want to expose the AudioFormat structure to plugins; remove some
clutter by moving its declaration to a separate header file.
|
|
|
|
|
| |
Anonymous code blocks just to declare variables look ugly. Move the
variable declarations up and disband the code block.
|
|
|
|
|
|
|
| |
Similar to previous patch: eliminate one variable by using "break".
This also simplifies the code since we can remove one level of indent.
[ew: rewritten to match current API]
|
|
|
|
|
| |
"break" is so much easier than "eof=1; continue;", when "!eof" is the
loop condition.
|
|
|
|
|
|
|
| |
Include only headers which are really required. This speeds up
compilation and helps detect cross-layer accesses.
[ew: minor fixups to not break on new core]
|
|
|
|
|
|
| |
Also enable -Wunused-parameter - this forces us to add the gcc
"unused" attribute to a lot of parameters (mostly library callback
functions), but it's worth it during code refactorizations.
|
|
|
|
| |
Previously, it was not possible to check for e.g. "-std=c99".
|
|
|
|
|
| |
Fix a "unused argument" warning, and several warnings regarding void
pointer calculation.
|
|
|
|
|
|
|
| |
Using struct iovec means having to cast iov_base everywhere
we want to do pointer arithmetic. Instead, just use rbvec
which can be safely casted to iovec whenever we use
the readv/writev functions.
|
|
|
|
|
| |
Fix a "signed/unsigned comparison warning", and several void pointer
math warnings.
|
|
|
|
|
| |
This avoids writing the metadata of a static song into
the URL of song; leading to confusing looking playlists.
|
|
|
|
|
|
| |
I considered calling it from metadata_pipe_recv() in
the past, but it's not necessary, so just inline it
again to simplify things.
|
|
|
|
|
|
|
|
|
| |
unK reported a bug in which explicitly calling "delete"
on each song would cause mpd to lock up. This is actually
triggered when the only song on the mpd playlist is deleted.
Additionally, add an extra assertion to ensure we play
a valid, non-NULL song in play_order_num().
|
|
|
|
|
|
| |
This way if we previously had a seek error, starting
to play a new song will immediately update the status
metadata.
|
|
|
|
|
|
|
|
|
| |
Hopefully this fixes a segfault I experienced inside
freeMpdTag earlier with the metadata_pipe. I could
not reproduce the segfault again, however.
Regardless, if multiple threads rely on this, we need to
atomically increment/decrement these counters.
|
|
|
|
|
|
|
| |
When we send metadata, there's a remote chance that our pipe is
full and our tag will be silently discarded. If that happens,
the readers will never have a chance to free the tag, so ensure
we free it before returning to the caller.
|
|
|
|
| |
I just forgot to reenable/reinitialize it after the core rewrite.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This has been tested for both playback of streams and
outputting to streams, and seems to work fine with minimal
locking. This reuses the sequence number infrastructure
in OutputBuffer for synchronizing metadata payloads; so
(IMNSHO) should be much more understandable than various
flags being set here and there..
It could still use some cleanup and much testing, but
synchronization issues should be minimal.
|
|
|
|
|
|
|
|
|
|
| |
When deleting previous songs, we forgot to update the
playlist.queue value, causing syncPlaylistWithQueue to
trigger a false sync and screw with the playlist.current
pointer; causing the currentsong command to return
an incorrect song.
Thanks to unK to reporting this bug!
|
|
|
|
|
|
|
|
| |
When moving songs around, we forgot to update the
playlist.queue value, causing syncPlaylistWithQueue to
trigger a false sync and screw with the playlist.current
pointer; causing the currentsong command to return
an incorrect song.
|
|
|
|
|
|
| |
It's possible to calculate an impossibly small value that
we don't have a chance to xfade. Don't die if we can't
find the boundary to start crossfading on
|