Bug 29999

Summary: [GStreamer] Should handle unknown duration better
Product: WebKit Reporter: Sebastian Dröge (slomo) <slomo>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: jmalonzo, pnormand
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
patch for duration query
none
patch for duration query, try 2 jmalonzo: review+, jmalonzo: commit-queue-

Description Sebastian Dröge (slomo) 2009-10-02 01:28:41 PDT
Hi,
currently there's only a check for -1 duration if GStreamer before 0.10.23 is used.

This is wrong, you should always check if

a) returned duration is != -1 (<= 0 is wrong, it could be <-1 because in TIME format it really is an unsigned integer with -1 as special value)
b) fmt is still GST_FORMAT_TIME

in case a) and b) are not true the duration is simply unknown.
Comment 1 Sebastian Dröge (slomo) 2009-10-02 01:42:41 PDT
Sames goes for the query_duration() calls in BYTE format btw.
Comment 2 Benjamin Otte 2009-10-06 02:17:23 PDT
Created attachment 40703 [details]
patch for duration query

Here's a patch for the time duration query. I'm not flagging it for review yet even though I'm pretty sure it's correct, but I'd like Sebastian to look it over just to be sure.
Comment 3 Sebastian Dröge (slomo) 2009-10-06 03:01:06 PDT
Almost correct, yes. Just remove the complete GStreamer version check and only check for time!=GST_CLOCK_TIME_NONE. "negative" times are always ok because the time really is a unsigned integer.
Comment 4 Benjamin Otte 2009-10-07 07:06:44 PDT
Created attachment 40785 [details]
patch for duration query, try 2
Comment 5 Sebastian Dröge (slomo) 2009-10-12 03:36:20 PDT
Looks good to me
Comment 6 Jan Alonzo 2009-10-13 03:10:49 PDT
Comment on attachment 40785 [details]
patch for duration query, try 2


> +    if (!gst_element_query_duration(m_playBin, &timeFormat, &timeLength) ||
> +        timeFormat != GST_FORMAT_TIME ||
> +        timeLength == GST_CLOCK_TIME_NONE) {

We don't normally break the expression into multiple lines. I'll fix it up when landing.

Is it possible to test this or is this covered by our existing tests already?

r=me.
Comment 7 Jan Alonzo 2009-10-19 04:58:52 PDT
(In reply to comment #6)
> (From update of attachment 40785 [details])
> 
> > +    if (!gst_element_query_duration(m_playBin, &timeFormat, &timeLength) ||
> > +        timeFormat != GST_FORMAT_TIME ||
> > +        timeLength == GST_CLOCK_TIME_NONE) {
> 
> We don't normally break the expression into multiple lines. I'll fix it up when
> landing.
> 
> Is it possible to test this or is this covered by our existing tests already?
> 
> r=me.

Landed as http://trac.webkit.org/changeset/49774