Commit Graph

4865 Commits

Author SHA1 Message Date
ejurgensen
aa36353480 [player] Fixup crash if playback stops while sending metadata 2019-03-22 23:24:11 +01:00
ejurgensen
95deef9c06 A bit of scan-build fixup 2019-03-22 22:15:13 +01:00
ejurgensen
4fb45e84f2 [player/outputs] New metadata handling (wip) 2019-03-18 23:06:08 +01:00
ejurgensen
ab0a6055b9 [input] Refactor metadata handling + add playback wait timeout
Previously input_metadata_get() would retrieve artwork from the source being
read currently, which might not be the one that triggered the FLAG_METADATA
event. So to fix this the metadata is now read by the input module itself when
the METADATA event happens, and the result is stored with the marker.

The commit also includes a timer so that the input thread does loop forever
if the player never starts reading.

Also some refactoring of metadata + abolish input_metadata_get and
input_quality_get. The latter in an attempt to treat the two in the same way.
2019-03-18 23:06:08 +01:00
ejurgensen
992ab90876 [xcode] Fix missing "&" 2019-03-18 23:06:08 +01:00
ejurgensen
b8e0280567 [outputs] Add a 10 sec stop timer + drop playback_stop()
In the output implementations playback_stop() was somewhat redundant,
since device_stop() does the same.

The timer should make sure that we always close outputs (previously
they were in some cases kept open).

The commit also includes some renaming.
2019-03-18 23:06:08 +01:00
ejurgensen
e3d39cff9b [player] Fix incorrect setting of buffer size to outputs 2019-03-18 23:06:08 +01:00
ejurgensen
f7096890f6 [player] Fix incorrect calculation of timestamp due to integer overflow 2019-03-18 23:06:08 +01:00
ejurgensen
daf7d755eb [input] Fix input writing too slowly for buffer to fill up after underrun
After an underrun the player doesn't read, so that meant input_wait would
wait a second before allowing the input to write, even though the input_buffer
was not full
2019-03-18 23:06:08 +01:00
ejurgensen
9b31264a3c [xcode] Use av_get_bytes_per_sample instead of av_get_bits_per_sample
av_get_bits_per_sample(ctx->settings.audio_codec) may return 0 with some codecs
2019-03-18 23:06:08 +01:00
ejurgensen
01797662de [cast] Fix segfault from cast_master_session not being reset 2019-03-18 23:06:08 +01:00
ejurgensen
f8b0147b12 [cast] First draft of Chromecast based on RTP (instead of mp3)
Includes adaptions to modified outputs interface
2019-03-18 23:06:08 +01:00
ejurgensen
9b6a892984 [rtp] Extra commenting about the RTP header 2019-03-18 23:06:08 +01:00
ejurgensen
d762bd0a56 [raop] master_session_free should allow null as argument 2019-03-18 23:06:08 +01:00
ejurgensen
3e4766ffaa [outputs] Fix segfault if encode_reset() fails to setup an encode_ctx 2019-03-18 23:06:08 +01:00
ejurgensen
1285128b9a [xcode] Fix incorrect source BPS detection + support for more audio qualities 2019-03-18 23:06:08 +01:00
ejurgensen
39037c7c8b [player] Fix typo 2019-03-18 23:06:08 +01:00
ejurgensen
8cf717664d [player] Don't call event_read_quality() twice 2019-03-18 23:06:08 +01:00
ejurgensen
63a2e750c7 [pulse] Convert Pulseaudio to new interface, incl support for native quality
First draft, probably has a few bugs
2019-03-18 23:06:08 +01:00
ejurgensen
3c2ff294a1 [player] Fix rewind problem where quality level was lost by player
+ remember to flush in source_start(), since the input won't do it if
input_now_reading has already been closed (e.g. if starting a new track
while playback is at the end of another track)
2019-03-18 23:06:08 +01:00
ejurgensen
50c7d96bc4 [raop] Remove flush timer, the player now takes care of stopping
Player now stops 10 secs after stop command and 10 mins after pause. At
that time the outputs have probably cut the connection themselves, but
that might be ok (needs testing).
2019-03-18 23:06:08 +01:00
ejurgensen
2893e597c3 [player] Partially revert commit ec9633c, now don't do full stop straight away
It is normal for the player to be called with stop() and then start(), so we
should keep the outputs open for a while.
2019-03-18 23:06:08 +01:00
ejurgensen
4017ce8846 [player] Fixup to commit 8f39c65, avoid crash when queue ends 2019-03-18 23:06:08 +01:00
ejurgensen
fc20b55a9b [raop] Log sync packet times 2019-03-18 23:06:08 +01:00
ejurgensen
977f8570a5 [player] Fix handling of underrun/read_deficit
* Also call full_cb() from input_wait if buffer is full
* Make read_deficit count missing bytes instead of clock ticks
* Make read_deficit a part of the playback session
2019-03-18 23:06:08 +01:00
ejurgensen
143708368c [alsa] Fix sync check
Sync correction still not implemented
2019-03-18 23:06:08 +01:00
ejurgensen
0f83b09ef7 [player] Fix incorrect setting of start timestamp
The time stamp was getting set too late, because if pos was zero the first
reads then it would be overwritten, but it shouldn't because the loop will
catch up even if the initial reads have zero samples.
2019-03-18 23:06:08 +01:00
ejurgensen
16469f6fa3 [player] Fixup missing fix from merge conflict resolution 2019-03-18 23:06:08 +01:00
ejurgensen
a37c9b4839 [player] Change name that was incorrect from merge conflict resolution 2019-03-18 23:06:08 +01:00
ejurgensen
2472aa9463 [player] Add timer to stop playback after being paused for a while 2019-03-18 23:06:08 +01:00
ejurgensen
b56b56af07 [input] Cleaning up 2019-03-18 23:06:08 +01:00
ejurgensen
107fa3634b [spotify] Remove obsolete .start reference 2019-03-18 23:06:08 +01:00
ejurgensen
cfaceab9fe [outputs] Misc fixup 2019-03-18 23:06:08 +01:00
ejurgensen
9d5555152c [alsa] Implement new output interface + some refactoring
Sync still missing
2019-03-18 23:06:08 +01:00
ejurgensen
b811122566 [outputs] Rename output_buffer.frame to .data 2019-03-18 23:06:08 +01:00
ejurgensen
5c35e1a9db [player] Completely stop devices on playback_stop()
Previously we just flushed, and local audio devices would never get closed.
Also a little fixup to the printing of session debug.
2019-03-18 23:06:08 +01:00
ejurgensen
19694ee1dd [misc] Add ringbuffer utility to misc.c/misc.h 2019-03-18 23:06:08 +01:00
ejurgensen
9dfab16138 [streaming] Cleaning bugs from refactor 2019-03-18 23:06:08 +01:00
ejurgensen
201c97fdf8 Fixup 3 - remove small risk of crash if encode_setup called incorrectly 2019-03-18 23:06:08 +01:00
ejurgensen
de55acf797 [input] Fixup 2: Seeking when rewinding to 0 2019-03-18 23:06:08 +01:00
ejurgensen
c74b305983 [outputs] Fix crash, invalid reference to device after outputs_device_add 2019-03-18 23:06:08 +01:00
ejurgensen
b7add1d0fa [inputs/player] Fixup part 1 2019-03-18 23:06:08 +01:00
ejurgensen
d008e241cf [outputs] Make outputs_device_flush (per device flushing)
Works better with the callback mechanism
2019-03-18 23:06:08 +01:00
ejurgensen
87ca6363ae [player/input] Refactor - WIP
* Open input sources earlier
* Gapless playback
* Remove fixed 44100/16 from player
* Complete restructure player internals
2019-03-18 23:06:08 +01:00
ejurgensen
e97ad7d970 [outputs] Reinstate device->activated, so that mdns flukes can't bring down playback 2019-03-18 23:06:08 +01:00
ejurgensen
936103f462 [outputs] Move device_add/rm to outputs and get rid of advertised flag 2019-03-18 23:06:08 +01:00
ejurgensen
a7e8476996 [outputs] Refactor outputs some more, eg change callback system 2019-03-18 23:06:08 +01:00
ejurgensen
e99f20992e [player/outputs] Implement changed output interfaces in most backends
Still missing cast, alsa and pulseaudio, but these can so far just be
disabled with configure.

Otherwise still mostly untested.
2019-03-18 23:06:08 +01:00
ejurgensen
14a6d318f0 [outputs] Changes to interface of outputs module
* Drop output_sessions, was just a pointer to the actual session anyway
* Drop the old write, flush and stop prototypes
* Some minor changes/renaming

Purpose of this is also to fix a race condition in player.c where it
could try to start two sessions on the same speaker. This could happen
because outputs_device_start() in line 2093 is conditional on device->session
which however is false while a device is starting up.
2019-03-18 23:06:08 +01:00
ejurgensen
cee740ae51 [misc] Move MIN() macro from raop.c to misc.c 2019-03-18 23:06:08 +01:00