Bug: Streaming transcoded data sends wrong range to flashpla

Need help? Post your questions here.

Moderator: moderators

Bug: Streaming transcoded data sends wrong range to flashpla

Postby cetu » Mon Sep 21, 2009 9:55 am

Hi,

First of all: Sorry I don't know where bug reports have to go.

Anyway I discovered the following bug:

When I stream transcoded files, e.g. wma-files, using the flashplayer, streaming stops in the middle of the song. This happens especially with low bandwith input files (64kbps for example).

I think I've tracked down the Bug to sourcecode-file "StreamController.java"

I'm now referring to the svn-version checked out on 2009-09-20 late evening of StreamController.java:

In lines 122 to 128 of said file:
Code: Select all
                if (range != null) {
                    response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT);
                    Util.setContentLength(response, file.length() - range.getMinimumLong());
                    LOG.info("Got range: " + range);
                } else {
                    Util.setContentLength(response, file.length());
                }

By Util.setContentLength you tell the player the filesize of the current song. This filesize is the filesize of the original not yet transcoded file.

In line 149
Code: Select all
in = new PlaylistInputStream(player, status, transcodingService, musicInfoService, audioScrobblerService, searchService);

you request transcoding for the file. And later on this transcoded "in" is send to the player. But "in" will have a different filesize than "file". So the player gets confused.

P.S.
This is my first post: I'm really impressed of subsonic! :D It's exactly what I had been looking for. Now I can share my entire music collection with everyone in the house and stream it easily to every client, which doesn't need anything but a web-browser. Cool! Keep up the good work!

Best Regards
Daniel Schmitz
cetu
 
Posts: 2
Joined: Mon Sep 21, 2009 9:33 am

Postby cetu » Mon Sep 21, 2009 2:31 pm

As a workaround, I simply changed lines 116 to 132 into:
Code: Select all
  if (!transcodingRequired) {
                    response.setHeader("ETag", StringUtil.utf8HexEncode(path));
                    response.setHeader("Accept-Ranges", "bytes");
                    range = StringUtil.parseRange(request.getHeader("Range"));
               
                    if (range != null) {
                       response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT);
             
                       Util.setContentLength(response, file.length() - range.getMinimumLong());
               
                       LOG.info("Got range: " + range);
                    } else {
 
                       Util.setContentLength(response, file.length());
                   
                    }
                }

So I don't let the player know about the filelength and disable sending of partial content, if transcoding is required. This seems to work.
cetu
 
Posts: 2
Joined: Mon Sep 21, 2009 9:33 am

Postby e3zkiel » Sat Oct 17, 2009 7:32 pm

how did you compile the "StreamController.java"?

Whenever I use javac to compile with your changes it states that I have 51 errors. When I try to compile the original it states there are 80 odd errors.

Please let me know what exactly you changed and how!!! I am having the same exact error as you and wish to fix it.

Thank you!!!

I am currently using 3.8.beta1 (build 1064) – October 2, 2009

and am running Subsonic on Apache Tomcat/6.0.20, java 1.6.0_16, Windows 2003 (24.7 MB / 35.7 MB).

:D
e3zkiel
 
Posts: 3
Joined: Sat Oct 17, 2009 7:27 pm

Postby burjast » Wed Oct 28, 2009 12:28 pm

I also have problems with range I think,

I basically transcode movies with ffmpeg, and view in vlc. When I open stream, everything looks normal, except vlc wont show anything, logs look quite normal.

Workaround to view movie is "killall ffmpeg" on linux, and when ffmpeg is killed, another instance "comes to life" and movie in that same VLC window starts to play.


First two ranges appear, when movie is not working:
[2009-10-28 07:55:31,008] INFO StreamController - Got range: Range[0,9223372036854775807]
[2009-10-28 07:55:34,519] INFO StreamController - Got range: Range[183300808,9223372036854775807]

After killing ffmpeg process another range:
[2009-10-28 07:55:39,711] INFO StreamController - Got range: Range[64768,9223372036854775807]

And movie plays. I hope some fix will be released soon, because I use subsonic on daily basis. Tnx, and keep up the good work.
burjast
 
Posts: 71
Joined: Mon Jul 20, 2009 9:00 am
Location: Slovenia

Postby sindre_mehus » Fri Nov 13, 2009 7:31 pm

cetu, thanks for pointing out this bug (and sorry for the late reply).

I'll fix this for the next release.

Cheers,
Sindre
Subsonic developer
User avatar
sindre_mehus
 
Posts: 1955
Joined: Tue Nov 29, 2005 6:19 pm
Location: Oslo, Norway

Postby e3zkiel » Wed Jan 20, 2010 6:45 am

Hello Sindre, please don't forget to add this topic to your TODO list! I am still experiencing this issue and is hindering my ability to listen to my music away from home! Thank you for all of your effort and support!

Huge Subsonic Supporter!!

-e3zkiel
e3zkiel
 
Posts: 3
Joined: Sat Oct 17, 2009 7:27 pm

Postby sindre_mehus » Wed Jan 20, 2010 8:01 am

Hi,

It's already fixed, but not yet released. Subsonic 3.9 will be available in a week or two, I hope.
Subsonic developer
User avatar
sindre_mehus
 
Posts: 1955
Joined: Tue Nov 29, 2005 6:19 pm
Location: Oslo, Norway

Postby e3zkiel » Wed Jan 20, 2010 4:42 pm

Thank you Sindre!! Looking forward to another successful update.

-e3zkiel :D
e3zkiel
 
Posts: 3
Joined: Sat Oct 17, 2009 7:27 pm

Re: Bug: Streaming transcoded data sends wrong range to flas

Postby klm46 » Mon Dec 17, 2012 4:26 pm

Hi @ all,

i also got an issue with the wrong range. it appears random when streaming over Webbrowser via Internet. Once a song got this failure, it appears again and again while this connection.

Code: Select all
[17.12.12 17:19:45 MEZ]   INFO   StreamController   Got range: Range[7357020,7357020]


in subsonic_sh.log is a bar, i donÄt know if this is an issue:

Code: Select all
[GC 6774K->3662K(72128K), 0.0012360 secs]
[Full GC 3662K->3597K(72128K), 0.1438260 secs]


Code: Select all
Version   4.7 (build 3105) – 11. September 2012
Server   jetty-6.1.x, java 1.6.0_24, Linux (46,2 MB / 68,8 MB)



edit: if i choose a new player in the same browser-connection, the mp3 will be played.
klm46
 
Posts: 12
Joined: Wed Dec 12, 2012 10:02 am


Return to Help

Who is online

Users browsing this forum: No registered users and 19 guests