After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 557171 - enhance filesrc to support progressive download
enhance filesrc to support progressive download
Status: RESOLVED WONTFIX
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
0.10.21
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-10-21 01:23 UTC by Wang Xuefeng
Modified: 2011-05-19 08:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gstfilesrc.h.patch (1.50 KB, patch)
2008-10-21 01:32 UTC, Wang Xuefeng
rejected Details | Review
gstfilesrc.c.patch (16.03 KB, patch)
2008-10-21 01:33 UTC, Wang Xuefeng
rejected Details | Review

Description Wang Xuefeng 2008-10-21 01:23:19 UTC
Progressive Download is a very popular feature supported by nearly all commercial players. The typical user case is:

- User click an http URL, which link to a media content (such as a mp3 file), in browser
- Browser downloads the mp3 file, and starts a player to play it.
- The player shall start playback as soon as enough data is available, before everything has been downloaded.

This feature can provide better user experience than normal RTSP / HTTP streaming, especially, if user want to replay the content later. This technology has been used by a lot of video share community, such as YouTube.

Currently filesrc only supports to read from a local file. Motorola enhances filesrc to support to read from a progressive downloading file, whose filesize is incremental. If the player wants to access data outside downloaded range, filesrc will block pipeline, until the all needed data is arrived. So, the pipeline can play a downloading file step by step. Filesrc shall run in push mode while enable PD. A protocol of "pd://" is added for this feautre, the uri parser is also enchaned, I add a suffix "?pd-filesize=xxx" to the file name, which indicates the file size of  a completed progressive downloaded file.

3 properties are added to support PD:
is-pd, whether to use PD mode
pd-filesize, indicate predefined file size, is-pd will be set to true if pd-filesize is set 
pd-downloadedsize, indicate incremental downloaded size

This patch uses a macro of GST_DISABLE_FILESRC_PD to enable/disable PD(Progressive Download) feature. Default is disable GST_DISABLE_FILESRC_PD.
This feature is conflicted with use-mmap, that is use-mmap must be false when enable PD.

Now, do_seek hasn't been implemented yet, will be implemented in the future.

Changed files:
gstfilesrc.c
gstfilesrc.h

example:
Download http://brwtest.vicp.net/media/Video/MP4/MatrixII3_320x240_20fps_350kbps.mp4 to local disk, the temp file name is /home/w20711/MatrixII3_320x240_20fps_350kbps.mp4.part

You can use gst-launch and playbin2 to play it.
./gst-launch-0.10 playbin2 -v uri=pd:///home/w20711/music/MatrixII3_320x240_20fps_350kbps.mp4.part?pd-filesize=2091279

It works well while filesrc runs in push mode.
While filesrc runs in pull mode, I've met following issues:
1) typefind will read the last 32 bytes, which hasn't be downloaded yet, the whole pipeline will blocks.
2) if filesrc blocks before the pipeline enters playing state, a deadlock occurs. This is because the timer in filesrc runs in GMainLoop, which hasn't been started yet, as a result, the timer cannot be launched, then the downloaded data cannot be updated.

Motorola would like to contribute the patch to the  Gstreamer open source
community project. Please find attached the patch applicable for Gstreamer. For
any questions, please feel free to contact (Zhao Liang "e3423c@motorola.com",
Shi Ling "w20230@motorola.com", Wang Xuefeng "w20711@motorola.com").
Comment 1 Wang Xuefeng 2008-10-21 01:32:49 UTC
Created attachment 120978 [details] [review]
gstfilesrc.h.patch
Comment 2 Wang Xuefeng 2008-10-21 01:33:39 UTC
Created attachment 120979 [details] [review]
gstfilesrc.c.patch
Comment 3 Wim Taymans 2008-10-24 13:08:02 UTC
A different more modular approach is in queue2 with the temp-location property. It also implements the buffering protocols.
Comment 4 Shi Ling 2008-10-27 02:21:20 UTC
Hi,
I checked queue2 and found it must work with neonhttpsrc, who will download media files. 

But, in most cases, it's the browser or other 3-rd party application download the content, does the community have any solution about it?
Comment 5 Stefan Sauer (gstreamer, gtkdoc dev) 2011-03-07 07:36:19 UTC
Shi, the http source should no do the on-disk buffering. This would duplicate the efforts as there are different http sources for gstreamer (soup, neon, curl, ...)
Comment 6 Sebastian Dröge (slomo) 2011-05-19 08:56:12 UTC
I'll close this as WONTFIX now, progressive downloading can be implemented for every source by using queue2... as is done in playbin2 for example.