The test webrtc/audio-peer-connection-webaudio.html has become a flaky crash on Sierra, El Capitan, and iOS simulator Debug tests according to the dashboard. https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=webrtc%2Faudio-peer-connection-webaudio.html https://build.webkit.org/builders/Apple%20Sierra%20Debug%20WK2%20(Tests)/builds/2330 https://build.webkit.org/results/Apple%20Sierra%20Debug%20WK2%20(Tests)/r220178%20(2330)/results.html The change that caused the failure is most likely: https://trac.webkit.org/changeset/219377/webkit ASSERTION FAILED: writtenAudioDuration >= readAudioDuration /Volumes/Data/slave/sierra-debug/build/Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp(124) : bool WebCore::RealtimeOutgoingAudioSource::isReachingBufferedAudioDataHighLimit() 1 0x109fd736d WTFCrash 2 0x1133be0fe WebCore::RealtimeOutgoingAudioSource::isReachingBufferedAudioDataHighLimit() 3 0x1133be47c WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable(WTF::MediaTime const&, WebCore::PlatformAudioData const&, WebCore::AudioStreamDescription const&, unsigned long) 4 0x1133bea39 WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable(WebCore::MediaStreamTrackPrivate&, WTF::MediaTime const&, WebCore::PlatformAudioData const&, WebCore::AudioStreamDescription const&, unsigned long) 5 0x1133becac non-virtual thunk to WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable(WebCore::MediaStreamTrackPrivate&, WTF::MediaTime const&, WebCore::PlatformAudioData const&, WebCore::AudioStreamDescription const&, unsigned long) 6 0x11314cebe WebCore::MediaStreamTrackPrivate::audioSamplesAvailable(WTF::MediaTime const&, WebCore::PlatformAudioData const&, WebCore::AudioStreamDescription const&, unsigned long) 7 0x1133aace7 WebCore::RealtimeMediaSource::audioSamplesAvailable(WTF::MediaTime const&, WebCore::PlatformAudioData const&, WebCore::AudioStreamDescription const&, unsigned long) 8 0x1131d7bf9 WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers(unsigned int) 9 0x1131d897b WebCore::MockRealtimeAudioSourceMac::render(double) 10 0x1131d69b9 WebCore::MockRealtimeAudioSource::tick() 11 0x1131d74c5 WTF::RunLoop::Timer<WebCore::MockRealtimeAudioSource>::fired() 12 0x10a027921 WTF::RunLoop::TimerBase::timerFired(__CFRunLoopTimer*, void*) 13 0x7fffafbf4e04 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ 14 0x7fffafbf4a93 __CFRunLoopDoTimer 15 0x7fffafbf45ea __CFRunLoopDoTimers 16 0x7fffafbebfc1 __CFRunLoopRun 17 0x7fffafbeb544 CFRunLoopRunSpecific 18 0x7fffaf14bebc RunCurrentEventLoopInMode 19 0x7fffaf14bcf1 ReceiveNextEventCommon 20 0x7fffaf14bb26 _BlockUntilNextEventMatchingListInModeWithFilter 21 0x7fffad6e4a54 _DPSNextEvent 22 0x7fffade607ee -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] 23 0x7fffad6d93db -[NSApplication run] 24 0x7fffad6a3e0e NSApplicationMain 25 0x7fffc5b7c8c7 _xpc_objc_main 26 0x7fffc5b7b2e4 xpc_main 27 0x103613105 main 28 0x7fffc5923235 start 29 0x1 LEAK: 4 WebPageProxy
<rdar://problem/33712305>
Created attachment 318449 [details] Crash log Just saw this crash with webrtc/peer-connection-remote-audio-mute.html https://build.webkit.org/results/Apple%20El%20Capitan%20Debug%20WK2%20(Tests)/r220876%20(2609)/results.html
Created attachment 320909 [details] Patch
This is a tentative fix, I was only able to reproduce the crash once.
Comment on attachment 320909 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=320909&action=review > Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:124 > + ASSERT(writtenAudioDuration + 0.0000001 >= readAudioDuration); The magic number isn't good, can you use WTF::areEssentiallyEqual() instead? > Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:133 > + ASSERT(writtenAudioDuration + 0.0000001 >= readAudioDuration); Ditto.
Created attachment 320939 [details] Patch
I was able to reproduce the patch once. It seems that sometimes at the very beginning we are reading more than what is available. I wonder whether the sample converter is filling with zeros. Previous patch was not covering this case. New patch adds a check to ensure that we do not call pullData if available pushed data is not at least 10ms. That should fix the crash and improves a bit on efficiency probably.
Created attachment 320940 [details] Patch
> pushed data is not at least 10ms. buffered data greater or equal to 10ms.
Comment on attachment 320940 [details] Patch Clearing flags on attachment: 320940 Committed r222109: <http://trac.webkit.org/changeset/222109>
All reviewed patches have been landed. Closing bug.