Bug 147008 - Media Session: add support for platform-specific interruption providers
Summary: Media Session: add support for platform-specific interruption providers
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-07-16 11:12 PDT by Matt Rajca
Modified: 2015-07-16 16:28 PDT (History)
4 users (show)

See Also:


Attachments
Patch (18.46 KB, patch)
2015-07-16 11:27 PDT, Matt Rajca
eric.carlson: 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-07-16 11:12:14 PDT
Interruption providers will notify media sessions of start/end-of-interruption events.
Comment 1 Matt Rajca 2015-07-16 11:27:54 PDT
Created attachment 256916 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2015-07-16 11:29:12 PDT
<rdar://problem/21858652>
Comment 3 Eric Carlson 2015-07-16 11:40:14 PDT
Comment on attachment 256916 [details]
Patch

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

> Source/WebCore/ChangeLog:9
> +        * platform/audio/MediaSessionInterruptionProvider.cpp: Added base class to be used by MediaSessionManager to

Nit: This isn't audio-specific, so why don't you put it into a new "platform/mediasession" directory?

> Source/WebCore/platform/audio/MediaSessionInterruptionProvider.cpp:37
> +MediaSessionInterruptionProvider::MediaSessionInterruptionProvider(MediaSessionInterruptionProviderClient& client)
> +    : m_client(&client)
> +{
> +    beginListeningForInterruptions();
> +}

Will there ever be more than one interruption provider? If so, what is the lifetime of an object - who creates it?

If there will only ever be one, you need a static accessor method and you need a way to add/remove clients.
Comment 4 Matt Rajca 2015-07-16 13:43:51 PDT
(In reply to comment #3)
> Comment on attachment 256916 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=256916&action=review
> 
> > Source/WebCore/ChangeLog:9
> > +        * platform/audio/MediaSessionInterruptionProvider.cpp: Added base class to be used by MediaSessionManager to
> 
> Nit: This isn't audio-specific, so why don't you put it into a new
> "platform/mediasession" directory?

Will do.

> 
> > Source/WebCore/platform/audio/MediaSessionInterruptionProvider.cpp:37
> > +MediaSessionInterruptionProvider::MediaSessionInterruptionProvider(MediaSessionInterruptionProviderClient& client)
> > +    : m_client(&client)
> > +{
> > +    beginListeningForInterruptions();
> > +}
> 
> Will there ever be more than one interruption provider? If so, what is the
> lifetime of an object - who creates it?

The interruption provider will only be used by the MediaSessionManager singleton (there will only be one client).

> 
> If there will only ever be one, you need a static accessor method and you
> need a way to add/remove clients.
Comment 5 Eric Carlson 2015-07-16 14:11:54 PDT
Comment on attachment 256916 [details]
Patch

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

> Source/WebCore/platform/audio/MediaSessionInterruptionProvider.h:57
> +    // To be overriden by subclasses.
> +    virtual void beginListeningForInterruptions();
> +    virtual void stopListeningForInterruptions();

If these must be overridden, why not make the pure-virtual?

> Source/WebCore/platform/audio/mac/MediaSessionInterruptionProviderMac.h:37
> +    using MediaSessionInterruptionProvider::MediaSessionInterruptionProvider;

Is this necessary?
Comment 6 Matt Rajca 2015-07-16 16:19:31 PDT
(In reply to comment #5)
> Comment on attachment 256916 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=256916&action=review
> 
> > Source/WebCore/platform/audio/MediaSessionInterruptionProvider.h:57
> > +    // To be overriden by subclasses.
> > +    virtual void beginListeningForInterruptions();
> > +    virtual void stopListeningForInterruptions();
> 
> If these must be overridden, why not make the pure-virtual?

These methods are called from the base class's constructor and destructor so they cannot be pure virtual.

> 
> > Source/WebCore/platform/audio/mac/MediaSessionInterruptionProviderMac.h:37
> > +    using MediaSessionInterruptionProvider::MediaSessionInterruptionProvider;
> 
> Is this necessary?

Yes, constructors aren't inherited.
Comment 7 Matt Rajca 2015-07-16 16:28:42 PDT
Committed r186917: <http://trac.webkit.org/changeset/186917>