Recordings in Chrome get jumbled sometimes |
|||||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36 Steps to reproduce the problem: 1. Record many recordings in serial in Chrome 2. Some recordings gets mixed, like the audio segments are repeated or get sent in the wrong timing 3. What is the expected behavior? The recording should be the same as what was recorded. What went wrong? Here is an example: The recording below should say: "Last name Randolph, R A N D O L P H". Instead you hear "Last name Randolph, R A N L P H L P H". Audio: https://drive.google.com/a/google.com/file/d/1o1fkCzezhdbE6Hv9J-BdKBrDOb2TYiJf/view?usp=sharing Did this work before? Yes Does this work in other browsers? N/A Chrome version: 62.0.3202.94 Channel: stable OS Version: Flash Version: I'm not sure when it started happening and I can't reproduce this in consistent way, it just happens sometimes.
,
Dec 5 2017
rmanor@ Thanks for the issue. Able to reproduce this issue on Ubuntu 14.04, Mac OS 10.12.6 and Windows 7 on the latest Chrome Stable 62.0.3202.94 and Canary 65.0.3284.0. On playing the recording, it is read out as "Last name Randolph, R A N L P H L P H". This is a Non-Regression issue as this is observed from M50 chrome builds. Hence marking this as 'Untriaged' for further updates from Dev. Thanks...
,
Dec 5 2017
Thanks.
Just to be clear the file I attached is the "mixed up" recording ("Last name Randolph, R A N L P H L P H") but the user has said to the microphone "Last name Randolph, R A N D O L P H".
,
Dec 6 2017
Is the application using Web Audio API somehow? Without knowing what the application does for the recording, we can't triage the issue correctly.
,
Dec 7 2017
Hi,
This my getUserMedia code:
window.AudioContext = window.AudioContext || window.webkitAudioContext;
var audio_context = new AudioContext();
var audio_api_error = '@@@';
var bad_mic_labels = ['@@@'];
var getAudioStream = function(micDeviceId) {
var constraints = {audio: true};
if (micDeviceId) {
constraints = {audio: {deviceId: micDeviceId}};
}
navigator.mediaDevices.getUserMedia(constraints)
.then(function(stream) {
var microphone = audio_context.createMediaStreamSource(stream);
cb(microphone);
})
.catch(function(e) {
console.log('Stream initialization error: ', e);
alert(audio_api_error);
});
};
var findUsbMicFunc = function() {
navigator.mediaDevices.enumerateDevices()
.then(function(deviceInfos) {
if (ignoreMicWhitelist) {
getAudioStream(undefined);
} else {
var mic_device_id = '';
for (var i = 0; i !== deviceInfos.length; ++i) {
if (deviceInfos[i].kind == 'audioinput' &&
bad_mic_labels.indexOf(deviceInfos[i].label) == -1) {
mic_device_id = deviceInfos[i].deviceId;
break;
}
}
if (mic_device_id == '') {
console.log('Could not find a USB mic.');
alert(audio_api_error);
} else {
getAudioStream(mic_device_id);
}
}
})
.catch(function(e) {
console.log('Error enumerating audio devices: ', e);
alert(audio_api_error);
});
};
// Enumerate devices for the logs.
navigator.mediaDevices.enumerateDevices()
.then(function(deviceInfos) {
console.log('Enumerated devices: ', deviceInfos);
})
.catch(function(e) {
console.error('Error enumerating audio devices: ', e);
});
// Now showing the consent prompt and calling the function chain.
navigator.mediaDevices.getUserMedia({audio: true}).then(findUsbMicFunc)
.catch(function(e) {
console.log('Error getting audio consent prompt: ', e);
alert(audio_api_error);
});
I'm using RecorderJs to record the audio and convert it to a wave file:
https://github.com/mattdiamond/Recorderjs
The page with the recording interface is here:
https://cs.corp.google.com/piper///depot/google3/quality/views/extraction/kcube/bg/operation/recording_studio/templates/studio.html?rcl=175506042&l=445
Thanks.
,
Dec 11 2017
Without being able to see the code behind the google wall, I can say that I have had similar issues and am using a highly hacked/modified version of recorderJs. The issue for me was that I was initially unaware that the scriptProcessorNode uses a single buffer between all of it's callbacks. If you don't quickly hand off the audio in the buffer, it can be overwritten by the data contained in the subsequent onaudioprocess callback. In my experience, the problem manifest itself in looping chunks of audio which seems to match this issue stated above. Making quick clones of the audio buffer or promptly handing it off to a webworker for further processing seemed to solve the problem. Hope that helps.
,
Dec 11 2017
,
Dec 11 2017
@jbnelsein, thanks! I'll try that.
,
Jan 3 2018
@jbnelsein, I'm using recorderjs which seems to copy the buffer right at the start of onaudioprocess: https://github.com/mattdiamond/Recorderjs/blob/master/src/recorder.js Do you have an example of your change? Thanks.
,
Jan 30 2018
Re #6 jbenslein@: > Without being able to see the code behind the google wall What do you mean by this? All the WebAudio code is public. > The issue for me was that I was initially unaware that the scriptProcessorNode uses a single buffer between all of it's callbacks. Technically it is "double-buffered". So if your main thread gets a performance hit and misses the deadline to fill the buffer, the data can be overwritten by the audio thread. Please note that ScriptProcessorNode is deprecated from the spec for this very reason. It is under-specified and the design is inherently unstable and laggy. Re #9 rmanor@: I recommend to do chrome://tracing with "audio", "blink_gc", "webaudio" categories. It will visualize the area where you're having performance issues. If you upload the trace data, I can be more helpful.
,
Jan 31 2018
What is the replacement for ScriptProcessorNode? Thanks.
,
Jan 31 2018
You can try this: https://developers.google.com/web/updates/2017/12/audio-worklet
,
Feb 13 2018
,
Feb 13 2018
rmanor@ Were you able to test the app with AudioWorklet?
,
Feb 14 2018
I haven't tried it yet, but so far it seems that cloning the audio buffer solved the issue.
,
Feb 14 2018
Per #15, I am closing this issue with Wontfix. Please open a new bug if it happens again. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by krajshree@chromium.org
, Dec 4 2017