New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 762958 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

Capture time DCHECK hit in media::AudioInputDevice::AudioThreadCallback::Process

Project Member Reported by grunell@chromium.org, Sep 7 2017

Issue description

Chrome Version: Dev build 63.0.3208.0, 935fae24e75ed434f7dce7cf9c92abbfece99844-refs/heads/master@{#499895}
OS: Mac

What steps will reproduce the problem?
(1) Build Chrome with dchecks enabled, add return statement first thing in AudioInputDevice::CheckIfInputStreamIsAlive() to disable the check[1].
(2) Use Macbook Pro and Soundblaster Tactic3D Rage USB headset, select as default in and out.
(2) Go to https://webrtc.github.io/samples/src/content/getusermedia/audio/, verify audio.
(3) Suspend machine, wait at least approx 30 seconds, resume.

Crash on capture time dcheck. Also some errors before that (when sample app started).

[37424:775:0907/160504.599090:ERROR:scoped_audio_unit.cc(43)] Failed to set current device for audio unit.: Error Domain=NSOSStatusErrorDomain Code=-10851 "(null)" (-10851)
[37424:775:0907/160504.599217:ERROR:audio_manager_mac.cc(628)] Failed to get the device channels, use stereo as default for device default
[37424:775:0907/160504.600564:ERROR:scoped_audio_unit.cc(43)] Failed to set current device for audio unit.: Error Domain=NSOSStatusErrorDomain Code=-10851 "(null)" (-10851)
[37424:775:0907/160504.600624:ERROR:audio_manager_mac.cc(628)] Failed to get the device channels, use stereo as default for device AppleHDAEngineInput:1F,3,0,1,0:1
[37424:775:0907/160504.602313:ERROR:scoped_audio_unit.cc(43)] Failed to set current device for audio unit.: Error Domain=NSOSStatusErrorDomain Code=-10851 "(null)" (-10851)
[37424:775:0907/160504.602373:ERROR:audio_manager_mac.cc(628)] Failed to get the device channels, use stereo as default for device AppleUSBAudioEngine:Creative Technology Ltd:SB Tactic3D Rage USB:000000047035:1
[37424:775:0907/160504.619377:ERROR:scoped_audio_unit.cc(43)] Failed to set current device for audio unit.: Error Domain=NSOSStatusErrorDomain Code=-10851 "(null)" (-10851)
[37424:775:0907/160504.619436:ERROR:audio_manager_mac.cc(628)] Failed to get the device channels, use stereo as default for device default
[37446:41727:0907/160712.436845:FATAL:audio_input_device.cc(448)] Check failed: base::TimeTicks::Now() >= capture_time (30645598604 bogo-microseconds vs. 30647247502 bogo-microseconds)
0   libbase.dylib                       0x00000001084965fc base::debug::StackTrace::StackTrace(unsigned long) + 28
1   libbase.dylib                       0x00000001084c0d50 logging::LogMessage::~LogMessage() + 224
2   libmedia.dylib                      0x000000011080d211 media::AudioInputDevice::AudioThreadCallback::Process(unsigned int) + 673
3   libmedia.dylib                      0x0000000110805e52 media::AudioDeviceThread::ThreadMain() + 242
4   libbase.dylib                       0x00000001085596af base::(anonymous namespace)::ThreadFunc(void*) + 95
5   libsystem_pthread.dylib             0x00007fff9268793b _pthread_body + 180
6   libsystem_pthread.dylib             0x00007fff92687887 _pthread_body + 0
7   libsystem_pthread.dylib             0x00007fff9268708d thread_start + 13

Dale, Olga told me you had changed something about the capture timestamp recently. Can you take a look?

[1] The check can incorrectly cause the stream to be stopped, fix for that is under review in https://chromium-review.googlesource.com/c/chromium/src/+/655082.
 
Components: Blink>WebRTC>Audio Internals>Media>Audio
Hmm, strange. There are known time jumps around a suspend resume, but I don't see how they would make the capture time >= now. We don't cache time values. So perhaps the time adjustment done by the FIFO is getting out of hand.

I don't have this device nor a mac today so I can't really debug this unfortunately.

grunell@ can you see if the discrepancy is coming from here:

https://cs.chromium.org/chromium/src/media/audio/mac/audio_low_latency_input_mac.cc?l=951


I printed out the capture_time at the three places it's updated in that function. Here's right before the hit:

[58394:155675:0908/155938.373577:ERROR:audio_low_latency_input_mac.cc(905)] Capture time (1): 56499542986 bogo-microseconds
[58394:155675:0908/155938.373585:ERROR:audio_low_latency_input_mac.cc(940)] Capture time (2): 56499542986 bogo-microseconds
[58394:155675:0908/155938.373600:ERROR:audio_low_latency_input_mac.cc(955)] Capture time (3): 56499552986 bogo-microseconds
[58394:155675:0908/155938.383612:ERROR:audio_low_latency_input_mac.cc(905)] Capture time (1): 56499552986 bogo-microseconds
[58394:155675:0908/155938.383627:ERROR:audio_low_latency_input_mac.cc(940)] Capture time (2): 56499552986 bogo-microseconds
[58394:155675:0908/155938.383646:ERROR:audio_low_latency_input_mac.cc(955)] Capture time (3): 56499562986 bogo-microseconds
[58394:155675:0908/155938.393621:ERROR:audio_low_latency_input_mac.cc(905)] Capture time (1): 56499562986 bogo-microseconds
[58394:155675:0908/155938.393634:ERROR:audio_low_latency_input_mac.cc(940)] Capture time (2): 56499562986 bogo-microseconds
[58394:155675:0908/155938.393653:ERROR:audio_low_latency_input_mac.cc(955)] Capture time (3): 56499572986 bogo-microseconds
[58394:155675:0908/155938.403608:ERROR:audio_low_latency_input_mac.cc(905)] Capture time (1): 56499572986 bogo-microseconds
[58394:155675:0908/155938.403628:ERROR:audio_low_latency_input_mac.cc(940)] Capture time (2): 56499572986 bogo-microseconds
[58394:155675:0908/155938.403656:ERROR:audio_low_latency_input_mac.cc(955)] Capture time (3): 56499582986 bogo-microseconds
[58394:155675:0908/155938.413638:ERROR:audio_low_latency_input_mac.cc(905)] Capture time (1): 56499582986 bogo-microseconds
[58394:155675:0908/155938.413678:ERROR:audio_low_latency_input_mac.cc(940)] Capture time (2): 56499582986 bogo-microseconds
[58394:155675:0908/155938.413730:ERROR:audio_low_latency_input_mac.cc(955)] Capture time (3): 56499592986 bogo-microseconds
[58394:155675:0908/155938.423650:ERROR:audio_low_latency_input_mac.cc(905)] Capture time (1): 56501286919 bogo-microseconds
[58394:155675:0908/155938.423693:ERROR:audio_low_latency_input_mac.cc(940)] Capture time (2): 56501286919 bogo-microseconds
[58394:155675:0908/155938.423753:ERROR:audio_low_latency_input_mac.cc(955)] Capture time (3): 56501296919 bogo-microseconds
[58414:42019:0908/155938.423838:FATAL:audio_input_device.cc(448)] Check failed: base::TimeTicks::Now() >= capture_time (56499606433 bogo-microseconds vs. 56501286919 bogo-microseconds)
0   libbase.dylib                       0x000000010ef035fc base::debug::StackTrace::StackTrace(unsigned long) + 28
1   libbase.dylib                       0x000000010ef2dd50 logging::LogMessage::~LogMessage() + 224
2   libmedia.dylib                      0x000000011a10f111 media::AudioInputDevice::AudioThreadCallback::Process(unsigned int) + 673
3   libmedia.dylib                      0x000000011a107d52 media::AudioDeviceThread::ThreadMain() + 242
4   libbase.dylib                       0x000000010efc66af base::(anonymous namespace)::ThreadFunc(void*) + 95
5   libsystem_pthread.dylib             0x00007fff9268793b _pthread_body + 180
6   libsystem_pthread.dylib             0x00007fff92687887 _pthread_body + 0
7   libsystem_pthread.dylib             0x00007fff9268708d thread_start + 13

The capture timestamp jumps around 2 seconds compared to previous timestamp while TT::Now() is 15 ms later than previous capture timestamp.
Cc: solenberg@chromium.org
It's the input timestamp (host time) that jumps almost 2 seconds, when Chrome's timeticks doesn't.
Cc: m...@chromium.org
Thanks for testing. Very strange, it looks like their host time updates faster after suspend than our standard calls to get mach time; despite CoreAudio folks saying it's just mach time.

+miu since he knows all things time :)
Ping miu@, seems not all mach timestamps are created equal :|
Probably we should go ahead and clamp these values to zero to avoid negative delay values from having weird impacts on WebRTC. WDYT?

Comment 8 by m...@chromium.org, Oct 6 2017

It's not clear to me what the bug is here. Can someone please explain?

1. Is it hardware-specific? If so, the driver is to blame; and workarounds should be specific to that situation.

2. Or, is this only triggered by a suspend+resume issue? If so, it sounds like the ideal solution would be to clear the FIFO after a suspend+resume (but that would take a lot to plumb-in).

3. Or, are we saying CoreAudio has a different source of time than mach_absolute_time() in some cases?

It's 3, somehow triggered by 2, but unrelated to the FIFO AFAICT.

Comment 10 by m...@chromium.org, Oct 6 2017

Is #3 a temporary condition that occurs for a short time after resume, or are the timestamps from CoreAudio always inconsistent with TimeTicks post-resume?
Unsure, grunell@ if you remove the DCHECK does TT::Now eventually resync?
@grunell, is this due to the same as issue 825744 ?
Derp, just realized that issue is Win and this is Mac.
Labels: Needs-Feedback
Owner: grunell@chromium.org
Needs feedback per c#11 though.

Sign in to add a comment