jasonmc / forked-daapd

A re-write of the firefly media server (mt-daapd). It's released under GPLv2+. Please note that this git repository is a mirror of the official one at git://git.debian.org/~jblache/forked-daapd.git
http://blog.technologeek.org/2009/06/12/217
GNU General Public License v2.0
328 stars 45 forks source link

Feature request: keepalive / timeout in forked-daapd.conf #19

Open Max905 opened 13 years ago

Max905 commented 13 years ago

After a certain length of time (30 minutes or so, I think), a DAAP stream will time out. For example, pause a stream playing via Rhythmbox or Banshee. Attempt to resume playback 30 minutes later. It will fail. The only way to resume playback is to disconnect from the DAAP server and reconnect. At that point, the prior playback position has been lost.

Is it possible to add a keepalive or timeout that could be controlled via a parameter in forked-daapd.conf?

ioquatix commented 12 years ago

I was planning to hook up a debugger and take a look, but I am away on a conference this week. However, if nothing has happened by next weekend I may take a look into the issue.

rdahlin commented 12 years ago

Any new news? I'm just waiting to have it working again.

//rdahlin

28659188 commented 12 years ago

I alos like to report, based on AMCC PowerPC platform, with iTune 10.5.x, the music streaming stops exact 5 minutes when you click the the library both in Windows XP/7 as well as Mac OS Lion. Looks like the port is closed after 5 minutes after starting of the connection. But we tried using 2 computers streaming from the NAS server with different starting time, the two streams play exactly 5 min regardless of their starting time. And we found out when that happens, iTune actually sending an rst packet to the server. Not sure the packet is the cause or the result?

pcace commented 12 years ago

No news? thats sad... i think im goin to use Subsonic or something else, to be independent to iTunes....

freultwah commented 12 years ago

It is not very hard to downgrade to 10.4.1, the last version that works well. The Internet is full of tutorials. It is a better solution than coming back with "me toos" every once in a while. It's not as if 10.5 brought some monumental changes, aside from the cockup with the protocol.

pcace commented 12 years ago

That is true, but 1. This is not a fix for the problem and second, here there are around 20 people using the shared library. I really cannot tell anybody to downgrade to 10.4.1!! There are a lot of users which simply can switch their machine on and use itunes + safari... Thats the reason why a real fix would be really great!

freultwah commented 12 years ago

True, it is not a fix and I, too, am anxiously awaiting one, and I cannot contribute, because I am not a programmer. Nothing has happened with forked-daapd for almost two months and I can only suspect it's for the lack of time on Julien's side (see: end of the year, busy time).

CraigMarkwardt commented 12 years ago

Greetings--

Over the new year, I did some investigation and found the problem. It's a detailed problem with how the forked-daapd server sends information about its capabilities to the client.

This patch appears to resolve the problem: https://github.com/CBGoodBuddy/forked-daapd/commit/bd10978d5240bc22c03a6f3bd0492a6318b7d67d The patch has been submitted upstream to the author Julien Blache as well.

It should apply against forked-daapd version 0.19 from the author, and is tested with many clients.

Also there is a separate patch to respond to issue #78, which should allow Banshee and Amarok clients to connect. Here is the patch: https://github.com/CBGoodBuddy/forked-daapd/commit/c2e6eeda3273c4ddca146424b61023d18080705e Also submitted upstream.

I do not have the capability to make .debs or other builds for embedded boxes, but hopefully there are others that do.

Best wishes for the new year! Craig

pcace commented 12 years ago

Hey, that sounds really great, but i cannot manage it to compile! i tried this: git clone https://github.com/CBGoodBuddy/forked-daapd.git - this should be your version with the changes!? then autoreconf -i, configure.... and then make. when i want to build forked-daapd, i get this error:

evhttp/http.c:28:26: fatal error: event-config.h: Datei oder Verzeichnis nicht gefunden compilation terminated. make[3]: * [forked_daapd-http.o] Error 1 make[3]: Leaving directory /home/user/Download/forked-daapd/src' make[2]: *** [all] Error 2 make[2]: Leaving directory/home/user/Download/forked-daapd/src' make[1]: *\ [all-recursive] Error 1 make[1]: Leaving directory `/home/user/Download/forked-daapd' make: * [all] Error 2

Any Idea what im doing wrong? the problem seems to be that there is no event-config.h. but where should this come from?

Thanks,

Pcace

CraigMarkwardt commented 12 years ago

If this is the first time you have built forked-daapd... it sounds like you are missing the prerequisites, probably "libevent" and development libraries. Unfortunately, I found that collecting all the dependencies was the worst part. Good luck getting that straightened out. It's one of the reasons I'm not able to work with the new 0.19gcd branch.

Also, be sure that you use branch "itunes_v10_5", i.e. git checkout itunes_v10_5 before you start the autoconf & build process.

Craig

freultwah commented 12 years ago

It looks as if he's using the gcd branch. As for the dependencies, that for me was no different for the gcd branch, since the only extra requirements are clang and libdispatch with blocks support. Perhaps give it another try, CBGoodBuddy? As for the patch itself, it works for me. I myself am on the libevent branch (gcd was unstable on my hardware and there was no point to it with a single core) and there were no hiccups there, 10.5.2 does not disconnect and all looks good so far, 33 minutes in.

pcace commented 12 years ago

hmm im not a programmer but try to understand what im doing here. Compiling the "original" forked daapd code (git clone https://github.com/jasonmc/forked-daapd.git) workes fine. So the problem is, im using the wrong code? how can i use the non gcd version?

Thanks,

Pcace

CraigMarkwardt commented 12 years ago

@pcace - I think the issue is that version 0.19 I'm branching from uses a different set of libraries - the original set. You need to be sure you have libevent and (probably) libevent-dev installed on your system. The most recent update to jasonmc/forked-daapd is called 0.19"gcd" which doesn't use libevent, but libdispatch instead, which is probably why your compilation of that branch worked.

You should also be able to apply the same git patches against the 0.19 tar file available from Julien Blache's home site.

@freultwah - my Linux box is has an older OS on it, so it's a fairly heroic effort to install all these special dependencies. I'd rather be doing some coding, or other things in my life, than figuring out dependency hell. :-)

pcace commented 12 years ago

i just reinstalled libevent (apt-get said: libevent-dev is already the newest version.)but still i get the information: evhttp/http.c:28:26: fatal error: event-config.h: Datei oder Verzeichnis nicht gefunden (not found...) (i also downloaded compiled and installed the newest version from libevent.org... (libevent-2.0.16-stable - but nothing helps...)

i really don't know what to do now ideas?

Thanks,

pcace

kazdegroot commented 12 years ago

If I remember correctly, newer versions of Ubuntu (and probably other distros) have upgraded to a newer, not backwards compatible libevent. Because of dependency issues the old version was put back in as something like libevent1.

Op 2 jan. 2012 om 12:14 heeft pcace reply@reply.github.com het volgende geschreven:

i just reinstalled libevent (apt-get said: libevent-dev is already the newest version.)but still i get the information: evhttp/http.c:28:26: fatal error: event-config.h: Datei oder Verzeichnis nicht gefunden (not found...)

i really don't know what to do now ideas?

Thanks,

pcace


Reply to this email directly or view it on GitHub: https://github.com/jasonmc/forked-daapd/issues/19#issuecomment-3328836

CraigMarkwardt commented 12 years ago

@pcace - you can check if you have this file which should be in /usr/include/event-config.h

It should be provided by the libevent-dev package as shown here....

dpkg -S event-config.h

libevent-dev: /usr/include/event-config.h

If the file is present on your system, then double check that the "configure" step worked right, i.e. it actually found the right version of libevent.

pcace commented 12 years ago

@kazdegroot in the debian repo there is no libevent1 nor a libevent1-dev...

@CBGoodBuddy yes it is there: root@t64:/home/user/Download/forked-daapd-0.19# dpkg -S event-config.h libevent-dev: /usr/include/event2/event-config.h

but what do i have to do now ;)?

pcace commented 12 years ago

hahaha, got it! Thank you all for your help! I just had to download and compile the libevent 1.4....

THANKS, hopefully forked-daapd works now how i wish ;)

pcace commented 12 years ago

Ok, forked-daapd is NOT running like i want i to do: i cannot connect from iTunes 10.5.2 (OSX Lion) i installed forked-daapd like that:

git clone https://github.com/CBGoodBuddy/forked-daapd.git cd forked-daapd git checkout itunes_v10_5 autoreconf -i ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-flac --enable-musepack make make install

everything seems to work, but i cannot connect to the server via itunes... did i miss something? i also manually controlled wether there are the new lines in the httpd_daapd.c i also checked wether it is the new compiled version im using: -rwxr-xr-x 1 root root 1296539 Jan 2 13:43 /usr/sbin/forked-daapd

any idea would be great! Thanks,

Pcace

sfelf commented 12 years ago

@pcace - Perhaps this line from the INSTALL file will be helpful in resolving your issue:

Support for iTunes Music Library XML format is optional. Use --enable-itunes to enable this feature.
elwertk commented 12 years ago

@pcace If this really is not working (you may want to reconfirm by enabling a more verbose log level to see what it does) you likely have some flaws in your build environment. I've seen this error >>evhttp/http.c:28:26: fatal error: event-config.h:<<< before and it indicates you had old configuration data from a gcd compile. These files are libevent includes that are patched and included in the source tree for the non GCD version. They are no longer required in GCD (no libevent)

Anyway further up you said that the compiling the original git works fine. So why not start from scratch from there?

clone the repo

git clone http://anonscm.debian.org/git/users/jblache/forked-daapd.git

cd to src dir

cd forked_daapd

checkout non gcd version (by tag = 0.19)

git checkout -b nongcd 0.19

autoreconf -i

run configure

./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-flac --enable-musepack

make

cd into src directory and run it from there in foreground. I.e like this

./forked_daapd -f -d 5 -D daap,main

and see what it does. (enable more debug options if you like)

Then just pick the commit you need from CBGoodBuddys repo. Some beautiful git magic ;-) Fetching the remote branch

git fetch git://github.com/CBGoodBuddy/forked-daapd.git itunes_v10_5

List commits in it

git log --oneline FETCH_HEAD

c2e6eed Fixes for Amarok and Banshee clients which don't send revision-number in their update request. bd10978 Fixes for iTunes v10.5 time-outs.

git cherry-pick bd10978

make

Repeat the test..

If this doesn't work as such your build system/dependencies/packages are broken somewhere.

Hope this helps..At least I seem to have written a howto on pullin in and apply this patch that maybe helpful to others.

BTW. debian provides libevent-dev and compability packages. Just stay away from anything that looks like libevent 2.xx

pcace commented 12 years ago

Hey, yes it seems that you have written a howto ;) thank you very much - the bad thing is, here it simply does not work. (here) i painfully followed every single of your steps, everything worked, BUT i still cannot connect with itunes. it simply happens nothing (also when i use 9 as logging level)

root@t64:/home/user/Download/forked-daapd/src# ./forked-daapd -d 9 -f -D daap,main main: Forked Media Server Version 0.19 taking off main: Initialized with gcrypt 1.5.0 main: mDNS init main: Initializing database main: Registering rendezvous names

nothing more happens also when i try to connect (i tried several machines...). the log simply stays like this...

Where else could i look for the missing part?!

Pcace

PS: when configuring i also tried to enable --enable-itunes

pcace commented 12 years ago

GOT it! @elwertk thank you sooo much for the hint to stay away "from anything that looks like libevent 2.xx". That was the reason why nothing worked. i uninstalled everything which had to do with libevent and reinstalled the 1.4.x. Now everything seems to work again!!! Thank you all for your great endurance with me ;)

Pcace

pcace commented 12 years ago

Hey, is it possible to use the patch also in the GCD version? maybe im wrong, but scanning takes much much longer with the non GCD version (?). The server here (dualcore intel 1,83ghz 4gb ram) scans my library now for around 4h and he did the half of it... (100.000 songs)...

But hey, @CBGoodBuddy thank you sooooo much for your Work!!!

CraigMarkwardt commented 12 years ago

The timeout patch won't apply directly to the 0.19 GCD version, sorry. I don't have that version up and running so I can't test it. In principle it's not that hard to change though.

lpar commented 12 years ago

Trying to build from the repo, I get

main.c:587: undefined reference to `register_ffmpeg_evbuffer_url_protocol'

at link time. Google searches lead me back to forked-daapd pages. Which library am I missing?

lpar commented 12 years ago

Oh, apparently you can just comment out the call to register_ffmpeg_evbuffer_url_protocol in main.c. Noting here in case anyone ends up here trying to solve the problem.

pcace commented 12 years ago

hey, there is one feature im missing now: auto-update! is there any possibility to have the library autoupdate function back? Thanks again for the fix!!! it just works!

CraigMarkwardt commented 12 years ago

@lpar: strange, register_ffmpeg_evbuffer_url_protocol is part of the distribution, in src/ffmpeg_url_evbuffer.c. It shouldn't have flagged as a linking error unless you also had a compilation error.

@pcace: in August I filed a patch to do automatic updating, but the maintainer did not accept it. From what I can tell, neither of the new releases from September (0.19 nor 0.19gcd) has the capability to do automatic updating, so I'm kind of surprised that you were enjoying it. The easiest workaround is to disconnect and reconnect to your iTunes server. New library additions should appear then.

pcace commented 12 years ago

@CBGoodBuddy: i know! I used your patch to have automatic updating enabled.... So again my question: do i have any chance to have this again? Thanks, Pcace

lpar commented 12 years ago

From the configure script, it looks like the code switches from using ffmpeg for evbuffers to using libavformat if libavformat is new enough. Unfortunately this isn't working properly, and src/ffmpeg_url_evbuffer.c isn't getting compiled and linked in if libavformat's major version is < 53.

I tested by downloading and compiling libav 0.7, and with that, the build process worked fine.

BernardV commented 12 years ago

@CBGoodBuddy This fix works! Thanks alot!

If you want to have a test environment to test gcd etc I can provide you with a VM to do so, I've compiled it on that VM. You can even listen to the server if you use openvpn (it's configured to send broadcasts).

Thanks!

Bernard

CraigMarkwardt commented 12 years ago

@BernardV thanks for your offer, that's very kind and I appreciate it.

Unfortunately one of my stumbling blocks is that the new "GCD" version is actually written in a new dialect of the C programming language and I don't quite understand how it works. It's all very cutting edge, but unfortunately I have a masters degree in keepin' it old style. That, plus my real life is intruding for a while. I'll keep your kind offer in mind.

BernardV commented 12 years ago

Would there be interest in a virtualbox image with both the latest git version compiled and the iTunes fix version compiled? I can make and host such an image on the latest debian stable (I think :) I now have a mix of testing/stable).

markgsd commented 12 years ago

Just FYI - for Ubuntu 11.10 users, all you have to do is download the Ubuntu source package, replace src/httpd_daap.c with the @CBGoodBuddy 's patched version of the file, and do the package rebuild. A good how-to for this is http://www.cyberciti.biz/faq/rebuilding-ubuntu-debian-linux-binary-package/

faz commented 12 years ago

@CBGoodBuddy @markgsd Thanks guys, just compiled a pkg for Ubuntu 11.10 - worked flawlessly!

kekiefer commented 12 years ago

Craig, great work on this fix. For anyone who's interested, I ported the changes to the GCD version, and it seems to be working for me. Any feedback is appreciated!

https://github.com/kekiefer/forked-daapd/commit/77dc0fd2f466a02b86582ed2c5f97ea6e444f2ac

CraigMarkwardt commented 12 years ago

@kekiefer well done! Be sure to forward your patch information to Julien Blache so that (hopefully!) he can put it in the next release.

pcace commented 12 years ago

Hmm again i do not understand so well what im doing to install this patch... i did: git clone https://github.com/jasonmc/forked-daapd.git then downloaded this file: https://raw.github.com/kekiefer/forked-daapd/77dc0fd2f466a02b86582ed2c5f97ea6e444f2ac/src/httpd_daap.c and copied it to the src folder. Then compiled forked-daapd. When using it, i cannot skip in tracks, and there is no length of tracks. What is wrong there?

Thanks,

Pcace

EDIT: i also tried to clone https://github.com/kekiefer/forked-daapd.git and make this: the result is a forked-daapd version where i cannot skip in tracks...

pcace commented 12 years ago

Hmm i still cannot get the GCD to work properly,

can anyone again please help out ;) ?

When i compile the kekiefer version, there is no possiblility to skip in tracks...

Ideas?

Pcace

kekiefer commented 12 years ago

Thanks for the feedback, @pcace, sounds like I may have missed something.

Can someone confirm if track scrubbing works in @CBGoodBuddy's fix?

pcace commented 12 years ago

yes, in CBGoodBuddy's fix it works perfectly!

any news?

Pcace

pcace commented 12 years ago

Is it working at your machine? Whats wrong then there? is it working somewhere else?

rdahlin commented 12 years ago

Please can someone make a .dpkg I can't compile this.. My Debian installation just xxx with me so I just beg for a dpkg to install with instead...

lpar commented 12 years ago

http://ath0.com/forked_daapd-2_amd64.deb

6fff33ec0b756fa50fdf321949f7abb3 forked_daapd-2_amd64.deb

Note that this was made using checkinstall and I think it's missing the /etc/init.d script.

pcace commented 12 years ago

Any chance to have this *.deb for a 32 bit system? Thanks!!!

lpar commented 12 years ago

Not from me, unless there's some configuration option I'm unfamiliar with. My Debian system is pure 64 bit. Sorry.

pcace commented 12 years ago

Hmm ok no problem, but can you tell me which version this is exactly? Has it the fixes from @kekiefer also? - so is it the 0.19GCD with the ability to skip in tracks?

Thanks

lpar commented 12 years ago

commit f7d7dfc9195497cfe65f980ad6cacda1b2970ea7 of branch nongcd of http://anonscm.debian.org/git/users/jblache/forked-daapd.git patched as described by @elwertk above.

And a quick test reveals that skipping in tracks works for me.

ghost commented 12 years ago

Hi all, I've tried to compile the Ubuntu 11.10 source file as @markgsd said and now I can hear my music with Apple iTunes 10.6 for more than 5 minutes! Thanks @CBGoodBuddy for your nice work!

P.S. I'll post ASAP a link for my home-build .deb package (64bit version, of course) in my personal Website, so that people will not need to install the development tools... stay tuned!

UPDATE (24/03/2012 23:51): Hi, I've compiled the package for both platforms (32bit and 64bit) with the @CBGoodBuddy patch. These are the links:

http://www.gieffe.name/download/forked-daapd_0.19-1ubuntu1_i386.deb http://www.gieffe.name/download/forked-daapd_0.19-1ubuntu1_amd64.deb