[Live-devel] Get current playback position

Ross Finlayson finlayson at live555.com
Sat Oct 1 07:49:37 PDT 2011


> In addition to the NPT, ServerMediaSubsession::seekStream() also takes a clientId, a streamToken, and a streamDuration.

For your purpose, the "streamDuration" parameter can just be 0.0 - meaning: place no limit on how much data is streamed.

The other parameters come from your "RTSPServer::RTSPClientSession" object:
	- "fStreamStates[i].subsession" is a member variable.  For you, "i" is just 0 (because - for Transport Streams - there is only one 'substream' for each stream).
	- "fOurSessionId" is a member variable
	- "fStreamStates[i].streamToken" is also a member variable.  (Once again, for you, "i" is just 0.)

Similarly, for the new function that I proposed
	float ServerMediaSubsession::currentNPT(unsigned clientSessionId) const;
for getting the current NPT time, the parameters you need are the member variables:
	- "fStreamStates[i].subsession" (with "i" == 0)
	- "fOurSessionId" 

All of these member variables are "protected:" within  "RTSPServer::RTSPClientSession".

So, you can call these functions from your "RTSPServer::RTSPClientSession" object, provided, of course, that you subclass this - which I assume you have already done (because you have a custom server implementation).

I.e., you should be able to access these functions - "seekStream()" and "currentNPT()" (if I provide to to you) - by subclassing "RTSPServer::RTSPClientSession", without making *any* changes to the supplied library code.

The only remaining issue is how to call your new member function(s) of your subclassed "RTSPClientSession" object from outside the server - e.g., from an external thread.  The way to do this is using the new "EventTrigger" mechanism that's defined for "TaskScheduler".  (The "triggerEvent()" function is the only LIVE555 function that you're allowed to call from a separate thread (i.e., other than the one that runs the LIVE555 event loop).)

So, here's what I suggest you do.  Start by demonstrating that - without making *any* changes to the supplied library code - you can subclass "RTSPServer::RTSPClientSession" in such a way that you can call "seekStream()" with a desired NPT value, and trigger this from an external thread.  If (and only if) you can do this - and find that it works the way that you expect (i.e., changes the position of the stream without confusing the RTSP client) - then let me know, and I'll then go ahead and add the "currentNPT()" function (that you could use - in a similar way - to get the NPT 'bookmarks' that you want.)


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20111001/fd6fffa7/attachment.html>


More information about the live-devel mailing list