PDA

View Full Version : FWD on Random Mix hiccups



treble
2006-01-28, 00:45
Whenever I do a random mix and want to skip to the next song by either using the remote or slimserver software the song pauses for a couple of seconds after about 10 seconds into the song. This is not a random occurence, it happens all the time. THe time stays at 0:00, then after about 10 seconds pauses for a couple of seconds, then starts playing again, the clock continues then as well.

If I just let the song finish to the end, the next one plays fine.

This only happens with the random mix. I can play for example skip through a whole album or other playlist fine.

Anyone else seeing this?

My SB3 is wireless (signal strenght about 60-70%).
SlimServer Version: 6.2.2 - 5815 - Windows 2000 - EN - cp1252

treble
2006-01-28, 12:45
Following up on myself with some log entries (plugins and sql). Using MySQL.
On 11:37 pressed next song on slimserver. Next song starts playing right away, but then pauses for a couple of seconds after about 10 seconds into the song. Let the song play for a minute or so and skipped to the next song. Again hiccup after 10seconds. In the Windows Task Manager I see the mysqld-nt.exe take up the highest CPU (after System Idle) of about 10-40% from the moment I press skip to the end of the break in the song...

2006-01-28 11:37:00.1099 RandomPlay: received command open file:///F:/Maho%20Backup/Music/All%20Music/Music/VA/Harley-Davidson/Harley-Davidson%20Road%20Songs%20Vol.%201%20(Disc%201)%20-%201994/04%20-%20Lynyrd%20Skynyrd%20-%20Call%20Me%20The%20Breeze.mp3
2006-01-28 11:37:00.1106 RandomPlay: No client!
2006-01-28 11:37:00.1111 Backtrace:

frame 0: Plugins::RandomPlay::Plugin::commandCallback (/PerlApp/Slim/Control/Command.pm line 1439)
frame 1: Slim::Control::Command::executeCallback (/PerlApp/Slim/Player/Source.pm line 1691)
frame 2: Slim::Player::Source::openSong (/PerlApp/Slim/Player/Source.pm line 412)
frame 3: Slim::Player::Source::playmode (/PerlApp/Slim/Player/Source.pm line 823)
frame 4: Slim::Player::Source::jumpto (/PerlApp/Slim/Control/Command.pm line 950)
frame 5: Slim::Control::Command::execute (/PerlApp/Slim/Web/HTTP.pm line 674)
frame 6: Slim::Web::HTTP::processURL (/PerlApp/Slim/Web/HTTP.pm line 539)
frame 7: Slim::Web::HTTP::processHTTP (/PerlApp/Slim/Networking/Select.pm line 111)
frame 8: Slim::Networking::Select::select (slimserver.pl line 634)
frame 9: main::idle (slimserver.pl line 38)
frame 10: PerlSvc::Startup (perlsvc.pl line 1481)
frame 11: PerlSvc::_startup (slimserver.pl line 0)
frame 12: (eval) (slimserver.pl line 0)

2006-01-28 11:37:00.3561 RandomPlay: received command playlist jump +1
2006-01-28 11:37:00.3570 RandomPlay: while in mode: track, from Squeezebox
2006-01-28 11:37:00.9619 RandomPlay: received command newsong
2006-01-28 11:37:00.9628 RandomPlay: No client!
2006-01-28 11:37:00.9634 Backtrace:

frame 0: Plugins::RandomPlay::Plugin::commandCallback (/PerlApp/Slim/Control/Command.pm line 1439)
frame 1: Slim::Control::Command::executeCallback (/PerlApp/Slim/Player/Source.pm line 1212)
frame 2: Slim::Player::Source::trackStartEvent (/PerlApp/Slim/Networking/Slimproto.pm line 524)
frame 3: Slim::Networking::Slimproto::process_slimproto_fra me (/PerlApp/Slim/Networking/Slimproto.pm line 244)
frame 4: Slim::Networking::Slimproto::client_readable (/PerlApp/Slim/Networking/Select.pm line 111)
frame 5: Slim::Networking::Select::select (slimserver.pl line 634)
frame 6: main::idle (slimserver.pl line 38)
frame 7: PerlSvc::Startup (perlsvc.pl line 1481)
frame 8: PerlSvc::_startup (slimserver.pl line 0)
frame 9: (eval) (slimserver.pl line 0)

2006-01-28 11:37:01.6219 RandomPlay: received command newsong
2006-01-28 11:37:01.6229 RandomPlay: while in mode: track, from Squeezebox
2006-01-28 11:37:01.6237 RandomPlay: new song detected (1)
2006-01-28 11:37:01.6241 RandomPlay: Stripping off completed track(s)
2006-01-28 11:37:01.6245 RandomPlay: playRandom called with type track
2006-01-28 11:37:01.6249 RandomPlay: 8 songs remaining, songIndex = 1
2006-01-28 11:37:01.6277 Running SQL query: [SELECT DISTINCT genres.id AS id,genres.name AS name,genres.namesort AS namesort,genres.moodlogic_id AS moodlogic_id,genres.moodlogic_mixable AS moodlogic_mixable,genres.musicmagic_mixable AS musicmagic_mixable FROM genres ]
2006-01-28 11:37:01.6882 RandomPlay: Starting random selection of 1 items for type: track
2006-01-28 11:37:01.6908 Start and End node: [default:default]
2006-01-28 11:37:01.6930 Start and End node: [genre:default]
2006-01-28 11:37:01.6939 Field query. Need additional join. start and End node: [genre:genre]
2006-01-28 11:37:01.7010 Running SQL query: [SELECT DISTINCT tracks.id AS id,tracks.multialbumsortkey AS multialbumsortkey,tracks.thumb AS thumb,tracks.age AS age,tracks.remote AS remote,tracks.ct AS ct,tracks.audio AS audio,tracks.titlesort AS titlesort,tracks.album AS album,tracks.tracknum AS tracknum,tracks.url AS url,tracks.tag AS tag,tracks.title AS title,tracks.disc AS disc,tracks.fs AS fs FROM tracks, genre_track, genres WHERE genre_track.track = tracks.id AND genres.id = genre_track.genre AND ( genres.name IN ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) AND tracks.audio = ? ) ORDER BY RAND() LIMIT 1]
2006-01-28 11:37:01.7018 Bind arguments: [College Rock, Top 40, Chanson, Christmas, New Wave, Speech, Miscellaneous, Slow Rock, Jazz, Sonata, Post-Grunge, Alternative, New Country, Neo - Soul, Salsa, Comedy, Celtic, Tango, Latin Balad, Cuban, National Folk, AlternRock, Hip-Hop, Rock, Folk-Rock, Electronica, Adult Alternative, Electronic, Teen Pop, Bossa Nova, R&B, Children's, Classic Rock, Indie, Easy Listening, Teen Beat, Hard Rock, Southern Rock, Disco, Rock & Roll, Singer/Songwriter, Proto-Punk, Classical, Big Band, Samba, Psychedelic Rock, Rap, Ska, Folk Revival, Pop/Funk, Instrumental, Kids, Nu Jazz, Funk, Lounge, Latin, Punk, African, Alternative-Rock, CHR, Jazz+Funk, Holiday, Ballad, BritPop, World, Jazz Blues, Contemporary R&B, Tribal, Folk, Calypso, Reggae, Mixed Genres, Vocal, Folk/Rock, Adult Alternative Pop/Rock, Brazilian, Blues-Rock, Hard Rock, Heavy Metal, Synthpop, Darkwave, Cabaret, Soca, Oldies, Soundtrack, Worldbeat, Pop-Folk, Acoustic, Ethnic, Brazilian Folk, Other, Pop, Latin Jazz, Opera, Progressive Rock, Merengue, Rock & Roll, Blues, New Age, Country, Acid Jazz, Dance, Punk Pop, Alt. Rock, Soul, 1]

2006-01-28 11:37:19.4535 RandomPlay: Find returned 1 items
2006-01-28 11:37:19.4535 RandomPlay: Adding track: Head Over Heels / Broken [Live], 10735
2006-01-28 11:37:19.4564 Start and End node: [default:default]
2006-01-28 11:37:19.4574 Start and End node: [default:default]
2006-01-28 11:37:19.4593 Running SQL query: [SELECT DISTINCT tracks.id AS id,tracks.album AS album,tracks.url AS url,tracks.multialbumsortkey AS multialbumsortkey,tracks.ct AS ct FROM tracks WHERE ( tracks.audio = ? AND tracks.id = ? ) ORDER BY tracks.disc, tracks.tracknum, tracks.titlesort]
2006-01-28 11:37:19.4600 Bind arguments: [1, 10735]

2006-01-28 11:37:19.8158 RandomPlay: Playing continuous track mode with 11 items
2006-01-28 11:38:25.3760 RandomPlay: received command open file:///F:/Maho%20Backup/Music/All%20Music/Music/%27%20U%20V%20W%20X%20Y%20Z/Zap%20Mama/1999%20-%20A%20Ma%20Zone/01%20-%20Rafiki.mp3
2006-01-28 11:38:25.3766 RandomPlay: No client!
2006-01-28 11:38:25.3774 Backtrace:

frame 0: Plugins::RandomPlay::Plugin::commandCallback (/PerlApp/Slim/Control/Command.pm line 1439)
frame 1: Slim::Control::Command::executeCallback (/PerlApp/Slim/Player/Source.pm line 1691)
frame 2: Slim::Player::Source::openSong (/PerlApp/Slim/Player/Source.pm line 412)
frame 3: Slim::Player::Source::playmode (/PerlApp/Slim/Player/Source.pm line 823)
frame 4: Slim::Player::Source::jumpto (/PerlApp/Slim/Control/Command.pm line 950)
frame 5: Slim::Control::Command::execute (/PerlApp/Slim/Web/HTTP.pm line 674)
frame 6: Slim::Web::HTTP::processURL (/PerlApp/Slim/Web/HTTP.pm line 539)
frame 7: Slim::Web::HTTP::processHTTP (/PerlApp/Slim/Networking/Select.pm line 111)
frame 8: Slim::Networking::Select::select (slimserver.pl line 634)
frame 9: main::idle (slimserver.pl line 38)
frame 10: PerlSvc::Startup (perlsvc.pl line 1481)
frame 11: PerlSvc::_startup (slimserver.pl line 0)
frame 12: (eval) (slimserver.pl line 0)

2006-01-28 11:38:25.5986 RandomPlay: received command playlist jump +1
2006-01-28 11:38:25.5993 RandomPlay: while in mode: track, from Squeezebox
2006-01-28 11:38:26.9820 RandomPlay: received command newsong
2006-01-28 11:38:26.9828 RandomPlay: No client!
2006-01-28 11:38:26.9838 Backtrace:

frame 0: Plugins::RandomPlay::Plugin::commandCallback (/PerlApp/Slim/Control/Command.pm line 1439)
frame 1: Slim::Control::Command::executeCallback (/PerlApp/Slim/Player/Source.pm line 1212)
frame 2: Slim::Player::Source::trackStartEvent (/PerlApp/Slim/Networking/Slimproto.pm line 524)
frame 3: Slim::Networking::Slimproto::process_slimproto_fra me (/PerlApp/Slim/Networking/Slimproto.pm line 244)
frame 4: Slim::Networking::Slimproto::client_readable (/PerlApp/Slim/Networking/Select.pm line 111)
frame 5: Slim::Networking::Select::select (slimserver.pl line 666)
frame 6: main::idleStreams (/PerlApp/Slim/Web/Pages.pm line 572)
frame 7: Slim::Web::Pages::playlist (/PerlApp/Slim/Web/HTTP.pm line 769)
frame 8: Slim::Web::HTTP::generateHTTPResponse (/PerlApp/Slim/Web/HTTP.pm line 678)
frame 9: Slim::Web::HTTP::processURL (/PerlApp/Slim/Web/HTTP.pm line 539)
frame 10: Slim::Web::HTTP::processHTTP (/PerlApp/Slim/Networking/Select.pm line 111)
frame 11: Slim::Networking::Select::select (slimserver.pl line 634)
frame 12: main::idle (slimserver.pl line 38)
frame 13: PerlSvc::Startup (perlsvc.pl line 1481)
frame 14: PerlSvc::_startup (slimserver.pl line 0)
frame 15: (eval) (slimserver.pl line 0)

2006-01-28 11:38:27.1296 RandomPlay: received command newsong
2006-01-28 11:38:27.1305 RandomPlay: while in mode: track, from Squeezebox
2006-01-28 11:38:27.1310 RandomPlay: new song detected (2)
2006-01-28 11:38:27.1312 RandomPlay: Stripping off completed track(s)
2006-01-28 11:38:27.1323 RandomPlay: playRandom called with type track
2006-01-28 11:38:27.1329 RandomPlay: 8 songs remaining, songIndex = 2

sicoffey
2006-10-17, 10:55
Hi,

Did you ever get to the bottom of this issue? I am seeing the exact same (Random Mix causes a few seconds silence about 10 secs into each song). Suspect its performance related (given I'm using a NAS) but I'd like to know exactly ...

thanks
Simon

Heuer
2006-10-17, 11:23
This has been a known problem since 6.2 and tends to show itself if you are using FLAC or (worse) ALAC and running SS on a NAS.

According to the Infrant people it is to do with the way and time SS builds its random play list. Advancing a song causes SS to stop all other tasks, move forward a song and also add the next random song to the list. Takes processing power and memory. I have a NV with 1Gb of RAM but I still see a 2-5 second dropout - down from 10 seconds with stock RAM. Run SS on a powerful PC and it is not an issue.

Not an expert on this but I suspect SS needs to advance to the next song in the list and then delay adding a new entry rather than doing both at once. Not a problem if you are using lossy files as the SB3 buffer masks the problem.

Developers - Please feel free to correct me if I am wrong.

sicoffey
2006-10-17, 11:41
Thanks for the reply, sounds about right - maybe a developer could confirm or deny, as you said :-)

I guess I'll look into scripting a conversion of my collection from FLAC to MP3....

vacaboca
2006-10-17, 16:30
When I had my full collection (about 100k tracks, all mp3) on 6.3.1, I had this happen with every new Random Mix track... did some monitoring and saw HUGE disk queue spikes as well as CPU... so it's not limited to FLAC. I've since moved to a 6.5.1 nightly, and have dropped my collection to about 7k songs right now, and don't see it... as I'm slowly adding songs back in (working on tagging and quality consistency, re-ripping everything as I go, V0 VBR mp3, not interested in the FLAC storage hit right now given the size of my collection), I'm interested to see if/when this problem creeps up again.

sicoffey
2006-10-18, 04:09
Thanks, interesting to know that MP3 might not solve the problem.

If it is fixed in 6.5.1 then its a new problem for me because, from what I've heard, my NSLU2 won't cope with the overhead of MySQL. Ah well, I needed an excuse to buy a new NAS anyway :-)

Dr Lovegrove
2006-10-18, 04:57
On 18/10/06, sicoffey
<sicoffey.2fveqn1161169801 (AT) no-mx (DOT) forums.slimdevices.com> wrote:
>
> Thanks, interesting to know that MP3 might not solve the problem.

No, it wont. The problem is with the SQL query which randommix
uses. Essentially:

SELECT * FROM tracks ORDER BY RAND() LIMIT 1

Behind the scenes this will fetch ALL the tracks, sort them
randomly, then return the first track in the list. I just tried the
query on my main server and it takes 8 seconds to complete
(70k ish tracks)..

There must be ways of speeding this up, at least for the
simple non-filtering random cases.

In fact, there seems to be a fair bit of discussion on the subject
of speeding this up down:
http://dev.mysql.com/doc/refman/5.0/en/select.html

--
- Dr Lovegrove
Free Moose for all at:
http://www.rusticrhino.com/drlovegrove

Dr Lovegrove
2006-10-18, 05:10
On 18/10/06, Dr Lovegrove <drlovegrove (AT) gmail (DOT) com> wrote:
> On 18/10/06, sicoffey
> <sicoffey.2fveqn1161169801 (AT) no-mx (DOT) forums.slimdevices.com> wrote:
> >
> > Thanks, interesting to know that MP3 might not solve the problem.
>
> No, it wont. The problem is with the SQL query which randommix
> uses. Essentially:
>
> SELECT * FROM tracks ORDER BY RAND() LIMIT 1

Just had a bit more of a play..

Ok, so the original query is this, and it takes over 8s:

SELECT me.id, me.url, me.content_type, me.title, me.titlesort,
me.titlesearch, me.album, me.tracknum, me.timestamp, me.filesize,
me.disc, me.thumb, me.remote, me.audio, me.audio_size,
me.audio_offset, me.year, me.secs, me.cover, me.vbr_scale, me.bitrate,
me.samplerate, me.samplesize, me.channels, me.block_alignment,
me.endian, me.bpm, me.tagversion, me.drm, me.moodlogic_id,
me.moodlogic_mixable, me.musicmagic_mixable, me.musicbrainz_id,
me.playcount, me.lastplayed, me.lossless, me.lyrics, me.rating,
me.replay_gain, me.replay_peak FROM tracks me
LEFT JOIN genre_track genreTracks ON ( genreTracks.track = me.id )
WHERE ( audio = '1' AND genreTracks.genre IN ( '21', '26', '17', '22',
'18', '30', '16', '23', '29', '25', '27', '28', '20', '24', '19', '31'
)
AND ( ( lastPlayed IS NULL ) OR ( lastPlayed < '1161171000' ) ) )
ORDER BY RAND() LIMIT 1

If I strip out all the columns and just get it to sort the tracks id's
like this:

SELECT me.id FROM tracks me
LEFT JOIN genre_track genreTracks ON ( genreTracks.track = me.id )
WHERE ( audio = '1' AND genreTracks.genre IN ( '21', '26', '17', '22',
'18', '30', '16', '23', '29', '25', '27', '28', '20', '24', '19', '31'
)
AND ( ( lastPlayed IS NULL ) OR ( lastPlayed < '1161171000' ) ) )
ORDER BY RAND() LIMIT 1

It now takes under a second, and you're left with the random track ID, which
should be all it needs..

--
- Dr Lovegrove
Free Moose for all at:
http://www.rusticrhino.com/drlovegrove

sicoffey
2006-10-18, 05:19
Hats off, sounds like a fine patch to me. Is there some way I can "vote" for its inclusion into the code? (although I fear it wouldnt get back ported to 6.3 for my little NSLU2..)

vacaboca
2006-10-18, 20:25
Hats off, sounds like a fine patch to me. Is there some way I can "vote" for its inclusion into the code? (although I fear it wouldnt get back ported to 6.3 for my little NSLU2..)

Dr Lovegrove's detailing of the query definitely explains the performance/disk hit I've seen - that seems like an incredibly inefficient way to pull a random track. I imagine the intersection with selected genres is part of the problem - it necessitates creating a subset of all tracks before pulling a random track out of it. Since 99% of the time I listen to complete random, with no genres deselected or singled out, it would be nice to have it intelligently realize that fact and take the quicker path of picking a random rowid from the range of available tracks...

Thanks for the thinking, Dr Lovegrove... I imagine it's not quite so simple as your suggested patch, but I'd love to be wrong! Let me know if there's a bug/enhancement that I could vote on, too :)

Heuer
2006-10-19, 00:50
At last some sanity! Will someone be posting this as a bug we can vote for?

kdf
2006-10-19, 01:01
On 19-Oct-06, at 12:50 AM, Heuer wrote:

>
> At last some sanity! Will someone be posting this as a bug we can vote
> for?
>
you sound like a volunteer to me. if you feel strongly, please do.

-kdf

Nicola Fankhauser
2006-11-06, 11:44
hi

see http://bugs.slimdevices.com/show_bug.cgi?id=4477

there is a diff as well, cheers!

regards
nicola

Nicola Fankhauser
2006-11-06, 12:52
hi

see http://bugs.slimdevices.com/show_bug.cgi?id=4477

there is a diff as well, cheers!

regards
nicola

take care, this diff optimizes your SS to the point where RandomPlay does not even tell you what it's playing - that's what I call performance tuning! ;)

regards
nicola

Nicola Fankhauser
2006-11-07, 03:15
new patch available, fixes aforementioned nuisances + new SQL index to create to speed up things:

ALTER TABLE `tracks` ADD INDEX `trackAudioLastPlayed` (`audio`,`lastPlayed`)

cheers!

nicola