Bug 133452 - [MSE][Mac] Media does not generate 'ended' event when playing to duration.
Summary: [MSE][Mac] Media does not generate 'ended' event when playing to duration.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jer Noble
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-02 09:47 PDT by Jer Noble
Modified: 2014-06-02 12:44 PDT (History)
5 users (show)

See Also:


Attachments
Patch (17.81 KB, patch)
2014-06-02 10:08 PDT, Jer Noble
eric.carlson: review+
Details | Formatted Diff | Diff
Patch for landing (19.90 KB, patch)
2014-06-02 12:11 PDT, Jer Noble
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jer Noble 2014-06-02 09:47:05 PDT
[MSE][Mac] Media does not generate 'ended' event when playing to duration.
Comment 1 Jer Noble 2014-06-02 10:08:55 PDT
Created attachment 232387 [details]
Patch
Comment 2 Eric Carlson 2014-06-02 10:47:09 PDT
Comment on attachment 232387 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=232387&action=review

> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:325
> +    if (currentMediaTime() >= m_mediaSourcePrivate->duration()) {
> +        effectiveRateChanged();
> +        return;
> +    }

Do you want to post a rate changed notification if this is called when the rate is non-zero?

> Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:606
> +    if (!m_mediaSourcePrivate)
> +        return;
> +
> +    if (m_durationObserver)
> +        [m_synchronizer removeTimeObserver:m_durationObserver.get()];

Is there any reason to keep the observer for the (potentially invalid) duration if m_mediaSourcePrivate is NULL?
Comment 3 Jer Noble 2014-06-02 11:32:13 PDT
(In reply to comment #2)
> (From update of attachment 232387 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=232387&action=review
> 
> > Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:325
> > +    if (currentMediaTime() >= m_mediaSourcePrivate->duration()) {
> > +        effectiveRateChanged();
> > +        return;
> > +    }
> 
> Do you want to post a rate changed notification if this is called when the rate is non-zero?

Well, it doesn't hurt anything, but I guess the explicit notification isn't necessary.

> > Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:606
> > +    if (!m_mediaSourcePrivate)
> > +        return;
> > +
> > +    if (m_durationObserver)
> > +        [m_synchronizer removeTimeObserver:m_durationObserver.get()];
> 
> Is there any reason to keep the observer for the (potentially invalid) duration if m_mediaSourcePrivate is NULL?

Nope, I'll switch the order of these stanzas.
Comment 4 Jer Noble 2014-06-02 12:11:17 PDT
Created attachment 232391 [details]
Patch for landing
Comment 5 Jer Noble 2014-06-02 12:43:41 PDT
Committed r169536 <http://trac.webkit.org/changeset/169536>.
Comment 6 Jer Noble 2014-06-02 12:44:04 PDT
GTK Build fix landed in r169537.