Stuck at seeking problem on p2p stream server?
#1
I have been working quite hard to make a p2p stream server working with XBMC. This is probably due to my lack experience in C++ programming. Please give me a hand!

Brief background:

I am developing a p2p stream server for xbmc. The server will download video files (in wmv/rm/rmvb formats) from peers and it's contents can be accessed from a port assigned to the stream server cli via arguments. XBMC in question is svn 20436 and it's running on Ubuntu 9.04.

Problem encountered:

The problem I am having now is that the seek function apparently not working well with the stream server. Mplayer works fine with the same server.


Logs:

xbmc log
http://pastebin.com/f326410e0

tcpdump output passed to pipe : "grep -A 9 -B 20 HTTP"

http://pastebin.com/f46b50921

stream server log
http://pastebin.com/f198c0c06

The interesting thing can be found at the end of the log is that the server is sending the data in continuous sequence but xbmc is not acknowledging it.

Get the source code of the stream server:
http://xbox-remote.googlecode.com/svn/tr...am/xpps.cc

How to use the stream server binary:

First you need install the missing library

Add the following apt repository

deb http://ppa.launchpad.net/portis25/ppa/ubuntu karmic main
deb-src http://ppa.launchpad.net/portis25/ppa/ubuntu karmic main

then install the following libs:
libpps libppswrapper

Get binary from http://xbox-remote.googlecode.com/files/xpps

Finally, execute the binary with the following command

LD_PRELOAD=/usr/lib/libppswrapper-preload.so ./xpps -p 8809 -l pps://hwhna3oqea6y5udo2aqa.pps/%D5%E6-%C1%B5%BC%A7%CE%DE%CB%AB-01.rmvb

How to play the stream:
mplayer http://127.0.0.1:8809
Reply
#2
Two things..

1: xbmc will attempt to seek on the file. If you can't accept seeks you must return http errors on such request.

2: When xbmc is attempting the seek, it doesn't close the old http session. Thus you must be able to handle two http sessions, where one of them may be stalled (ie you can't write anything more to the socket).
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
elupus Wrote:Two things..

1: xbmc will attempt to seek on the file. If you can't accept seeks you must return http errors on such request.

2: When xbmc is attempting the seek, it doesn't close the old http session. Thus you must be able to handle two http sessions, where one of them may be stalled (ie you can't write anything more to the socket).

Thanks for your replay.

I have located the function in xbmc which is causing problems:
Code:
m_bSeekPossible = m_source.Seek(0, SEEK_POSSIBLE) > 0 ? true : false;
line 107 in file xbmc/FileSystem/FileCache.cpp.

The Seek function is a bit aggressive and fast. It will continuous try another file position if it is not happy with the current result. After numerous try it will start from ground zero (file position 0) and decide to halt there (a possible bug?).

Mplayer works fine because it will only seek once (when starting) to the near end of the file to decide whether it's seekable.

Is there anyway to restrict the range of seeking (m_bSeekPossible)? For example can we only try to seek at the beginning or end of the file? This should be enough to decide whether it's seekable and will also improve the startup speed.

The temporary solution for me however is to disable seekable checking:
Code:
--- xbmc/FileSystem/FileCache.cpp.orig  2009-10-10 21:49:43.000000000 +0100
+++ xbmc/FileSystem/FileCache.cpp       2009-10-10 21:50:00.000000000 +0100
@@ -103,12 +103,11 @@
     return false;
   }

-  // check if source can seek
-  m_bSeekPossible = m_source.Seek(0, SEEK_POSSIBLE) > 0 ? true : false;
-
+  // do not check whether the source can seek
+  m_bSeekPossible = true;
   m_readPos = 0;
-  m_seekEvent.Reset();
-  m_seekEnded.Reset();
+
+

   CThread::Create(false);

After the code change I can use xbmc to watch the movie and I am able to seek while playing.
Reply
#4
The problem goes away after I upgraded to 24523. It can be all because of it tries to determine the length of the video, see track:

http://trac.xbmc.org/changeset/24493/trunk

Now the video starts up super fast and plays smoothly, skip also seems takes much much less time.

Great job developers!!!!!!
Reply

Logout Mark Read Team Forum Stats Members Help
Stuck at seeking problem on p2p stream server?0