Bug 146132 - Support releasing media sessions
Summary: Support releasing media sessions
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 145411
  Show dependency treegraph
 
Reported: 2015-06-18 17:09 PDT by Matt Rajca
Modified: 2015-06-23 15:05 PDT (History)
5 users (show)

See Also:


Attachments
Patch (3.59 KB, patch)
2015-06-18 17:16 PDT, Matt Rajca
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Rajca 2015-06-18 17:09:16 PDT
Implement the release method described in section 5.1.3 of the Media Session spec, as well as its helper algorithm from section 4.6 "Releasing a media session".
Comment 1 Matt Rajca 2015-06-18 17:16:16 PDT
Created attachment 255155 [details]
Patch
Comment 2 Darin Adler 2015-06-19 11:23:43 PDT
Comment on attachment 255155 [details]
Patch

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

> Source/WebCore/Modules/mediasession/MediaSession.cpp:84
> +    while (!m_activeParticipatingElements.isEmpty()) {
> +        HTMLMediaElement* element = m_activeParticipatingElements.takeAny();
> +        element->pause();
> +    }

Could write this without the local variable:

    while (!m_activeParticipatingElements.isEmpty())
        m_activeParticipatingElements.takeAny()->pause();

> Source/WebCore/Modules/mediasession/MediaSession.cpp:98
> +    if (m_activeParticipatingElements.size() >= 1)

I think !isEmpty() would be better. Sometimes it’s better not to take specification language too literally! One or more doesn’t have to turn into >= 1.
Comment 3 Radar WebKit Bug Importer 2015-06-19 11:24:07 PDT
<rdar://problem/21464030>
Comment 4 Matt Rajca 2015-06-23 15:04:38 PDT
Committed r185885: <http://trac.webkit.org/changeset/185885>
Comment 5 Matt Rajca 2015-06-23 15:05:04 PDT
(In reply to comment #2)
> Comment on attachment 255155 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=255155&action=review
> 
> > Source/WebCore/Modules/mediasession/MediaSession.cpp:84
> > +    while (!m_activeParticipatingElements.isEmpty()) {
> > +        HTMLMediaElement* element = m_activeParticipatingElements.takeAny();
> > +        element->pause();
> > +    }
> 
> Could write this without the local variable:
> 
>     while (!m_activeParticipatingElements.isEmpty())
>         m_activeParticipatingElements.takeAny()->pause();
> 
> > Source/WebCore/Modules/mediasession/MediaSession.cpp:98
> > +    if (m_activeParticipatingElements.size() >= 1)
> 
> I think !isEmpty() would be better. Sometimes it’s better not to take
> specification language too literally! One or more doesn’t have to turn into
> >= 1.

Thanks for the feedback. Fixed.