Bug 168898 - [WebRTC] Fix remote audio rendering
Summary: [WebRTC] Fix remote audio rendering
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jer Noble
URL:
Keywords:
Depends on: 168860
Blocks:
  Show dependency treegraph
 
Reported: 2017-02-26 22:06 PST by Jer Noble
Modified: 2017-02-27 10:25 PST (History)
3 users (show)

See Also:


Attachments
Patch (45.36 KB, patch)
2017-02-26 23:43 PST, Jer Noble
eric.carlson: review+
Details | Formatted Diff | Diff
Patch for landing (45.33 KB, patch)
2017-02-27 09:16 PST, 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 2017-02-26 22:06:15 PST
[WebRTC] Fix remote audio rendering
Comment 1 Jer Noble 2017-02-26 23:43:18 PST
Created attachment 302825 [details]
Patch
Comment 2 youenn fablet 2017-02-27 09:06:23 PST
Comment on attachment 302825 [details]
Patch

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

> Source/WebCore/ChangeLog:8
> +        Test: webrtc/audio-peer-connection-webaudio.html

Great test!

> Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:95
> +            m_audioSourceProvider->prepare(&m_streamFormat);

OnData is called on one of webrtc threads (probably the network one).
audioSourceProvider getter method will probably be called on the main thread.
Shouldn't we execute this code in the main thread?

> LayoutTests/webrtc/audio-peer-connection-webaudio.html:11
> +        internals.useMockRTCPeerConnectionFactory("TwoRealPeerConnections");

Could you move this within the test block, just before the call to createConnections?
That may help if we add future tests in this file.

Btw, if one doesn't like async_test, promise_test can be used instead.
One would need to return the getUserMedia promise and create a new promise inside it.
The small benefit here would be the automatic handling of gum promise being rejected.
Not probably worth changing the test here.
Comment 3 Jer Noble 2017-02-27 09:15:19 PST
(In reply to comment #2)
> Comment on attachment 302825 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=302825&action=review
> 
> > Source/WebCore/ChangeLog:8
> > +        Test: webrtc/audio-peer-connection-webaudio.html
> 
> Great test!
> 
> > Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:95
> > +            m_audioSourceProvider->prepare(&m_streamFormat);
> 
> OnData is called on one of webrtc threads (probably the network one).
> audioSourceProvider getter method will probably be called on the main thread.
> Shouldn't we execute this code in the main thread?

The getter will probably be called on the WebAudio thread, but WebAudioSourceProviderAVFObjC has a lock which protects against prepare() and provideInput() being called simultaneously, so this should be fine. (The provideInput() side is a try-lock.)

> > LayoutTests/webrtc/audio-peer-connection-webaudio.html:11
> > +        internals.useMockRTCPeerConnectionFactory("TwoRealPeerConnections");
> 
> Could you move this within the test block, just before the call to
> createConnections?
> That may help if we add future tests in this file.

Sure.

> Btw, if one doesn't like async_test, promise_test can be used instead.
> One would need to return the getUserMedia promise and create a new promise
> inside it.
> The small benefit here would be the automatic handling of gum promise being
> rejected.
> Not probably worth changing the test here.

Yeah, if I were to re-write this test, I'd probably use the promise_test path.
Comment 4 Jer Noble 2017-02-27 09:16:27 PST
Created attachment 302844 [details]
Patch for landing
Comment 5 WebKit Commit Bot 2017-02-27 10:24:41 PST
Comment on attachment 302844 [details]
Patch for landing

Clearing flags on attachment: 302844

Committed r213080: <http://trac.webkit.org/changeset/213080>