EldoS | Feel safer!

Software components for data protection, secure storage and transfer

play Media without bad effect

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
#22728
Posted: 12/05/2012 10:43:32
by ttran Tran (Priority Standard support level)
Joined: 08/20/2012
Posts: 35

Hello,
The media file, for example .wmv is in the remote server.
When the user clicks on the media file icon, the Media Player plays, and we get smt like the freezing or bad video quality in a very short time. I think the reason relies on the event call-back:
CbFsReadFile(
CallbackFileSystem sender,
CbFsFileInfo FileInfo,
IntPtr FileHandleContext,
long Position,
byte[] Buffer,
int BytesToRead,
ref int BytesRead)

So based on the Position and the Buffer size, we invoke the data from the server, and it takes time. The consequence is the freezing or bad video quality.
To avoid this bad thing, each time, we try to read more data from the server than the Buffer size, and save in the temp file. So the next time of the request, hopefully the request data can be read immediately from the temp file. However we do not know what data part we should read from the server in advanced to store in the temp file. The CBFS read event is totally depended on the Media Player and the media file type.
What should we do in this case ?

Thanks
Tran
#22729
Posted: 12/05/2012 10:46:52
by Eugene Mayevski (EldoS Corp.)

Unfortunately there's not much you can do here besides learning some patterns about Media Player behavior (i.e. what parts it reads when playback starts, is there read-ahead caching in Media Player done etc) and trying to address them directly. Eg. if you know that Media Player will read 2Kb from the end of file right after opening the file and then will read the file sequentially (unless seek is performed by the user), you can start caching the tail of the file right from OnOpenFile callback handler, and when the tail is cached, start caching the beginning of the file.


Sincerely yours
Eugene Mayevski

Reply

Statistics

Topic viewed 918 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!