emarsden / dash-mpd-rs

Rust library for parsing, serializing and downloading media content from a DASH MPD manifest.
MIT License
67 stars 21 forks source link

Improve calling of progress observers #71

Open filiptibell opened 1 week ago

filiptibell commented 1 week ago

Hi! First of all, thank you for this great library 😄 I wouldn't have been able to accomplish the task without it.

I am having some issues with ProgressObserver and fetch functionality, mostly that it gets stuck and does not really update well during download of content. For example, it gets stuck at something like this when using a simple indicatif progress bar: [▪▸--------------------------] 1% (Fetching DASH manifest - 2 days remaining)

Obviously the download will not take 2 days, from experience it takes something like 10 minutes for full HD one hour on my connection. But because progress reporting gets "stuck" this estimate is what indicatif thinks after some seconds pass.

Digging into this issue a bit more and enabling tracing, it seems to be because fetch_fragment reports progress only after at least 1.5 seconds have passed, but it seems the stream I am using has tons of little fragments and downloads them all under this 1.5 second limit - progress never gets reported.

Would it be possible to base progress reporting instead on something like bytes downloaded / total or estimated bytes? If not, maybe progress report can be done a bit more often?

emarsden commented 1 week ago

Thanks, I've pushed a change that should hopefully fix this.