Bug 174494 - Report CoreAudioCaptureSource failure in case shared unit stops to work properly
Summary: Report CoreAudioCaptureSource failure in case shared unit stops to work properly
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-07-13 22:43 PDT by youenn fablet
Modified: 2017-07-14 10:44 PDT (History)
4 users (show)

See Also:


Attachments
Patch (9.74 KB, patch)
2017-07-13 22:54 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (9.97 KB, patch)
2017-07-14 09:03 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (9.97 KB, patch)
2017-07-14 09:13 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2017-07-13 22:43:25 PDT
CoreAudioCaptureSource sometimes fails working.
The capture callback is not called.
Being able to report that to the web app may be useful.
Comment 1 youenn fablet 2017-07-13 22:54:58 PDT
Created attachment 315403 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2017-07-13 22:55:43 PDT
<rdar://problem/33309776>
Comment 3 youenn fablet 2017-07-13 22:56:59 PDT
Patch allows triggering an owned event on a capture audio track that fails.
On such case, the web application will be able to react by making another call to getUserMedia which will create a new shared unit without any user prompt.
Then, the web app can use RTCPeerConnection.replaceTrack to send the audio content without any renegotiation.
Comment 4 youenn fablet 2017-07-13 22:56:59 PDT
Patch allows triggering an owned event on a capture audio track that fails.
On such case, the web application will be able to react by making another call to getUserMedia which will create a new shared unit without any user prompt.
Then, the web app can use RTCPeerConnection.replaceTrack to send the audio content without any renegotiation.
Comment 5 Eric Carlson 2017-07-14 05:48:00 PDT
Comment on attachment 315403 [details]
Patch

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

> Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp:192
> +    m_didCaptureFailed = true;

Nit: "did capture failed" isn't right so maybe "m_captureFailed" or "m_captureDidFail"?

> Source/WebCore/platform/mediastream/RealtimeMediaSource.h:146
> +    bool didCaptureFailed() const { return m_didCaptureFailed; }

Ditto.
Comment 6 Eric Carlson 2017-07-14 08:20:20 PDT
Comment on attachment 315403 [details]
Patch

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

> Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp:600
> +    m_verifyCapturingTimer.startRepeating(1_s);

Why one second, this seems really short? FWIW, it looks like Chrome checks every five seconds and ends the track after 12 seconds without a callback: https://codereview.chromium.org/2899413004/diff/40001/media/audio/audio_input_device.cc
Comment 7 youenn fablet 2017-07-14 08:55:43 PDT
(In reply to Eric Carlson from comment #6)
> Comment on attachment 315403 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=315403&action=review
> 
> > Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp:600
> > +    m_verifyCapturingTimer.startRepeating(1_s);
> 
> Why one second, this seems really short? FWIW, it looks like Chrome checks
> every five seconds and ends the track after 12 seconds without a callback:
> https://codereview.chromium.org/2899413004/diff/40001/media/audio/
> audio_input_device.cc

1_s might be too short indeed as audio start-up might be long.
I'll go with 5 seconds even if 5s without audio is quite long.

We could also start with something like 10s after start/resume and lower it to something like 2 seconds after that.
Comment 8 youenn fablet 2017-07-14 09:03:44 PDT
Created attachment 315425 [details]
Patch
Comment 9 youenn fablet 2017-07-14 09:04:08 PDT
(In reply to youenn fablet from comment #8)
> Created attachment 315425 [details]
> Patch

Went with the 10 seconds then 2 seconds approach.
Comment 10 youenn fablet 2017-07-14 09:13:20 PDT
Created attachment 315427 [details]
Patch
Comment 11 WebKit Commit Bot 2017-07-14 10:44:07 PDT
Comment on attachment 315427 [details]
Patch

Clearing flags on attachment: 315427

Committed r219511: <http://trac.webkit.org/changeset/219511>
Comment 12 WebKit Commit Bot 2017-07-14 10:44:09 PDT
All reviewed patches have been landed.  Closing bug.