Bug 37034 - [GStreamer] Player doesn't return to NETWORK_IDLE when not using network
Summary: [GStreamer] Player doesn't return to NETWORK_IDLE when not using network
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-02 11:49 PDT by Andrew Scherkus
Modified: 2021-04-14 06:36 PDT (History)
5 users (show)

See Also:


Attachments
proposed patch (2.25 KB, patch)
2011-03-14 10:05 PDT, Philippe Normand
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Scherkus 2010-04-02 11:49:42 PDT
In order to implement the suspend event, MediaPlayerPrivate implementations should return to NETWORK_IDLE when not using the network.
Comment 1 Philippe Normand 2010-07-22 04:01:34 PDT
I don't see NETWORK_LOADED in the spec anymore while we still use it.

http://www.w3.org/TR/html5/video.html#dom-media-networkstate

Should we replace Loaded with Idle?
Comment 2 Philippe Normand 2010-07-22 04:02:51 PDT
BTW the test to fix/unskip is http/tests/media/video-play-suspend.html
Comment 3 Philippe Normand 2010-07-22 05:10:13 PDT
LOADED is used when a media is fully buffered I think
and IDLE is when network is not used, so I guess it's kind of not the same ;)

I'm still confused though to still see we use LOADED and the spec not mentionning it anymore, or I'm reading the wrong one.
Comment 4 Eric Carlson 2010-07-22 07:31:00 PDT
(In reply to comment #1)
> I don't see NETWORK_LOADED in the spec anymore while we still use it.
> 
> http://www.w3.org/TR/html5/video.html#dom-media-networkstate
> 
NETWORK_LOADING and the 'loaded' event went away in r63684 (and a few follow-on build fixes ;-).


(In reply to comment #3)
> LOADED is used when a media is fully buffered I think
> and IDLE is when network is not used, so I guess it's kind of not the same ;)
> 
> I'm still confused though to still see we use LOADED and the spec not mentionning it 
> anymore, or I'm reading the wrong one.
We still have the internal state MediaPlayer::Loaded, but that translates to networkState == NETWORK_IDLE. This internal state is necessary so we can tell if we need to fire the 'suspend' event or not. The spec says this about the 'suspend' event:

The user agent is intentionally not currently fetching media data, but does not have the entire media resource downloaded.

http://www.w3.org/TR/html5/video.html#mediaevents

The 'suspend' event is only fired when the media engine sets networkState to MediaPlayer::Idle itself.
Comment 5 Philippe Normand 2010-07-23 05:53:46 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > LOADED is used when a media is fully buffered I think
> > and IDLE is when network is not used, so I guess it's kind of not the same ;)
> > 
> > I'm still confused though to still see we use LOADED and the spec not mentionning it 
> > anymore, or I'm reading the wrong one.
> We still have the internal state MediaPlayer::Loaded, but that translates to networkState == NETWORK_IDLE. This internal state is necessary so we can tell if we need to fire the 'suspend' event or not. The spec says this about the 'suspend' event:
> 
> The user agent is intentionally not currently fetching media data, but does not have the entire media resource downloaded.
> 
> http://www.w3.org/TR/html5/video.html#mediaevents
> 
> The 'suspend' event is only fired when the media engine sets networkState to MediaPlayer::Idle itself.

Hum does that mean we should set networkState to Idle when the media is fully loaded?

Sorry but I don't see how to make that test pass without doing that, simply because the media is local, download is instantaneous, so I don't see why a suspend event should be fired in this case.

In progressive download mode GStreamer will keep the download running even if the playback is paused, until it fully completes, AFAIK.
Comment 6 Steve Lacey 2011-03-01 12:45:10 PST
FYI, http/tests/media/video-play-suspend.html has been removed as the test isn't actually valid according to spec. See https://bugs.webkit.org/show_bug.cgi?id=55198 for details.
Comment 7 Philippe Normand 2011-03-02 00:31:38 PST
Thanks for the heads up Steve! Seems like this new test is passing on GTK. Does this mean we can close this bug?
Comment 8 Steve Lacey 2011-03-02 13:05:58 PST
You need to make sure you set the network state to loaded before transitioning to the final idle so that a final progress event is fired (see HTMLMediaElement.cpp). If you're doing this, all should be good.
Comment 9 Philippe Normand 2011-03-14 10:05:47 PDT
Created attachment 85687 [details]
proposed patch
Comment 10 Martin Robinson 2011-03-14 10:06:57 PDT
Comment on attachment 85687 [details]
proposed patch

Are there any tests covering this?
Comment 11 Philippe Normand 2011-03-14 10:23:46 PDT
(In reply to comment #10)
> (From update of attachment 85687 [details])
> Are there any tests covering this?

Hum it doesn't seem so. I'll try to write one :) Will clear the r+ flag for now.
Comment 12 Martin Robinson 2013-02-08 10:35:45 PST
If writing a test is a lot of work, it's probably okay just to land this as-is.
Comment 13 Xabier Rodríguez Calvar 2021-04-14 06:36:15 PDT
There is a http/tests/media/video-load-suspend.html test and it seems to check out now. I think we can close this.