Bug 242187 - DTMF tonechange event sometimes doesn't fire
Summary: DTMF tonechange event sometimes doesn't fire
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Safari 15
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-06-30 06:45 PDT by mawojtcz
Modified: 2022-08-18 00:52 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mawojtcz 2022-06-30 06:45:05 PDT
We've observed this in our integration tests that sometimes when we call insertDTMF() method with a string of characters, we only get the tonechange event for the first few characters and then it gets stuck and stops sending the events. For example we call transceiver.sender.dtmf.insertDTMF('0123456789') and we only get the events for '0', '1', '2' and nothing more. In our tests we are not making any other extra calls to insertDTMF().

Here is a jsFiddle link that reproduces this: 
https://jsfiddle.net/5qhc61vy/4/. 
When you use it, open the JS console and click the "start" button and observe the console logs. It will go in a loop doing the following steps:
1. sendDTMF('0123456789ABCD') method is called
2. we wait for all expected tonechange events
3. we sleep for 1 second
You can see the steady stream of logs appearing in the console - there is a log for each tonechange event.
On Safari, after a few iterations we get stuck and are not getting the tonechange event anymore. On Chrome and Firefox it works fine and goes on forever.
Comment 1 mawojtcz 2022-06-30 06:47:10 PDT
We've seen this issue on safari 14.x and 15.4, 15.5 also technology preview release 148
Comment 2 Radar WebKit Bug Importer 2022-07-07 06:46:13 PDT
<rdar://problem/96593903>
Comment 3 youenn fablet 2022-07-08 06:35:48 PDT
I was not able to reproduce on latest macOS 15 (STP and stock Safari).
Either LibWebRTCDTMFSenderBackend::OnToneChange is not called or it is sometimes called with a non empty tone but not with an empty tone.
Comment 4 mawojtcz 2022-07-11 02:03:29 PDT
It's a bit of a hit and miss when trying to reproduce it with that js fiddle. Sometimes I get it very quickly and sometimes it runs fine for a long time (30 minutes and more). Today I've just tried on Safari 15.5 (17613.2.7.1.8). I've started safari, loaded the js fiddle and it failed almost immediately - I only got 1 tonechange event for the first character ("0") and that's it - it was stuck. Then I restarted Safari, loaded the same js fiddle again and it was running fine for 40 minutes. After that I just refreshed the page, clicked "start" button and it failed within 30 seconds. Overall I think it's easier to reproduce the issue if you refresh the js fiddle page while the loop is running.
Comment 5 youenn fablet 2022-08-17 03:23:33 PDT
Pull request: https://github.com/WebKit/WebKit/pull/3400
Comment 6 EWS 2022-08-18 00:51:07 PDT
Committed 253551@main (90a55799cf72): <https://commits.webkit.org/253551@main>

Reviewed commits have been landed. Closing PR #3400 and removing active labels.
Comment 7 youenn fablet 2022-08-18 00:52:44 PDT
A temporary workaround while waiting for this fix to ship is to keep a reference to the dtmf object so that it does not get GCed.