Bug 221192 - "A MediaStreamTrack ended due to a capture failure" occurs in 30 seconds after peer connection establishes
Summary: "A MediaStreamTrack ended due to a capture failure" occurs in 30 seconds afte...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 14
Hardware: Mac (Intel) Unspecified
: P2 Major
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-01-31 17:18 PST by Vicky Cen
Modified: 2023-01-30 19:41 PST (History)
10 users (show)

See Also:


Attachments
sysdiagnose (251.70 MB, application/x-gzip)
2023-01-30 19:37 PST, rychouwei
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vicky Cen 2021-01-31 17:18:12 PST
"A MediaStreamTrack ended due to a capture failure" error occurs on Safari in around 30 seconds after peer connection establishes. This error can be observed most likely in Safari on BigSur 11.1 and 11.0.1, especially when multiple callers in a call. When this error occurs, safari caller will see self video tile as black, but remote callers can still see and hear safari caller well. But it does not on every device. If on 1 device it happens, it's likely to happen every time, and if on another device it does not happen, it's not likely to happen on that device. 

Seems it's same issue with more details has been reported in this thread: https://github.com/twilio/twilio-video.js/issues/1281
Comment 1 youenn fablet 2021-02-01 00:01:09 PST
Hi Vicky,
Can you reproduce with STP?
If you can reproduce it, would you be able to take a sysdiagnose and send it to me (youenn@apple.com)?

(In reply to Vicky Cen from comment #0)
> "A MediaStreamTrack ended due to a capture failure" error occurs on Safari
> in around 30 seconds after peer connection establishes. This error can be
> observed most likely in Safari on BigSur 11.1 and 11.0.1, especially when
> multiple callers in a call. When this error occurs, safari caller will see
> self video tile as black, but remote callers can still see and hear safari
> caller well.

If a local capture track gets ended, it seems strange that remote callers could still see the corresponding remote track.

> Seems it's same issue with more details has been reported in this thread:
> https://github.com/twilio/twilio-video.js/issues/1281

According the thread, this seems fixed in iOS 14.2
Comment 2 Vicky Cen 2021-02-02 21:50:17 PST
Hi Youenn,

I can reproduce with STP and sent you the sysdiagnose. 

However, it seems on STP when the error shows, safari caller will get black self video tile and remote caller can't see the track, but still can hear. (sysdiagnose attached and send to your email)

On Safari 14.0.2, I did see when the error shows, safari caller will get black self video tile but remote caller can both see and hear the safari user.
Comment 3 youenn fablet 2021-02-03 00:48:19 PST
Looking at sysdiagnose, some H264 encoding failures happen before capture starts failing.
Comment 4 Radar WebKit Bug Importer 2021-02-03 00:49:05 PST
<rdar://problem/73920852>
Comment 5 youenn fablet 2021-02-08 00:55:12 PST
*** Bug 220998 has been marked as a duplicate of this bug. ***
Comment 6 youenn fablet 2021-10-19 00:35:27 PDT
Vicky, can you still reproduce this issue on recent Safaris?
Comment 7 Vicky Cen 2021-10-24 21:59:11 PDT
Hi youenn, my colleagues and I have very limited number of testing on the latest Safari (Safari 15). We haven't seen this issue on Safari 15 so far.
Comment 8 James Hall 2022-01-05 07:11:39 PST
Seeing it on Safari 15.(In reply to Vicky Cen from comment #7)
> Hi youenn, my colleagues and I have very limited number of testing on the
> latest Safari (Safari 15). We haven't seen this issue on Safari 15 so far.
Comment 9 Charlie 2022-10-21 10:58:40 PDT
Hi Youenn,
We are seeing this on iPhone 14/iOS 16. Same reproduction steps. Do you have any updates on this?

Thank you.
Comment 10 Brian Liu 2022-11-15 16:51:44 PST
Ya, we are seeing the same issue on iPhone 14/iOS 16.0 and 16.0.1, simply create a video & audio streams and attach to MediaRecorder, record a video then destroy the stream tracks, repeating create streams and destroy tracks few times trigger the error

function stopStream(stream) {
  if (stream) {
    stream.getTracks().forEach((track) => {
      track.stop();
      stream.removeTrack(track);
    });
  }
}
Comment 11 daginge 2022-11-25 06:29:33 PST
Is it safe to assume this issue can be closed by this commit? https://github.com/WebKit/WebKit/commit/b818b253da1d92e9e5f802dea4a735b8adeb1994
Comment 12 youenn fablet 2023-01-20 02:17:42 PST
(In reply to daginge from comment #11)
> Is it safe to assume this issue can be closed by this commit?
> https://github.com/WebKit/WebKit/commit/
> b818b253da1d92e9e5f802dea4a735b8adeb1994

Not really, this issue is related to camera video tracks.
Comment 13 youenn fablet 2023-01-20 02:21:15 PST
(In reply to Charlie from comment #9)
> Hi Youenn,
> We are seeing this on iPhone 14/iOS 16. Same reproduction steps. Do you have
> any updates on this?
> 
> Thank you.

@Charlie, can you give more precise repro steps?
Is it the same as https://bugs.webkit.org/show_bug.cgi?id=247967?
Comment 14 rychouwei 2023-01-29 19:35:39 PST
We have the same issue.

The system version is: Intel Mac OS X 10_15_7, Safari 15.4

After about 30s of successful webrtc peerConnection connected, MediaStream audioTrack gives this error: "A MediaStreamTrack ended due to a capture failure".

We try to recapture the audioTrack with getUserMedia and use rtpSender.replaceTrack to try to resume the call, but once we call replaceTrack, the recaptured audioTrack comes back with the same error: "A MediaStreamTrack ended due to a capture failure".

It only occurs in some devices and looks like it might be related to the system version.
Comment 15 youenn fablet 2023-01-29 23:01:13 PST
(In reply to rychouwei from comment #14)
> We have the same issue.
> 
> The system version is: Intel Mac OS X 10_15_7, Safari 15.4
> 
> After about 30s of successful webrtc peerConnection connected, MediaStream
> audioTrack gives this error: "A MediaStreamTrack ended due to a capture
> failure".
> 
> We try to recapture the audioTrack with getUserMedia and use
> rtpSender.replaceTrack to try to resume the call, but once we call
> replaceTrack, the recaptured audioTrack comes back with the same error: "A
> MediaStreamTrack ended due to a capture failure".
> 
> It only occurs in some devices and looks like it might be related to the
> system version.

@rychouwei, can you send me a sysdiagnose (youenn@apple.com)?
Are you able to reproduce the issue reliably with some steps or specific setups?
Comment 16 rychouwei 2023-01-30 19:00:27 PST
@youenn

Is the guide in this link to get sysdiagnose? 

http://adcdownload.apple.com/OS_X/OS_X_Logs/sysdiagnose_Logging_Instructions.pdf

I'll try.
Comment 17 rychouwei 2023-01-30 19:37:20 PST
Created attachment 464772 [details]
sysdiagnose

1. At 11:08:28:203, MediaStream audioTrack is ended.
2. At 11:08:29:009, try getUserMedia to capture a new audioTrack.
3. At 11:08:30:505, try rtpSender.replaceTrack to replace the recaptured audioTrack.
4. At 11:08:30:511, the recaptured audioTrack is ended again.
Comment 18 rychouwei 2023-01-30 19:41:54 PST
@youenn

The sysdiagnose is provided. please check!

"Are you able to reproduce the issue reliably with some steps or specific setups?"

One of our customer's Intel Mac OS X 10_15_7, Safari 15.4 can reproduce the issue reliably, from the process is the most basic webrtc communication process, no specific steps found for now.