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

Issue 671308 link

Starred by 10 users

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug

Blocking:
issue 675787



Sign in to add a comment

Chrome does not respect OS X audio channel layout

Reported by arve.ber...@gmail.com, Dec 5 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.14 Safari/537.36

Example URL:
https://www2.iis.fraunhofer.de/AAC/multichannel.html

Steps to reproduce the problem:
1.  Use a multichannel audio interface (5.1)  - or HDMI to home theatre receiver.
2. Use Audio MIDI Setup to configure a non-traditional channel layout, such as (Front) Left/Right to channels 5/6 and Surround Left/Right to 1/2 - any configuration other than L:1, R:2, C:3, LFE:4, SL: 5, SR: 6 will do.
3. Visit URL with test cases
4. Play the various multichannel tests

What is the expected behavior?
In the audio files in the Fraunhofer test case URL, with the channel mapping from step 2 above, Front left and Front right should be routed to channels 5 and 6, and the rear/surround channels should play through channels 1/2.  

What went wrong?
Chrome ignores macOS' configured channel layout, and plays front left/right through channels 1/2, and surround through 5/6.

Did this work before? N/A 

Is it a problem with Flash or HTML5? HTML5

Does this work in other browsers? Yes

Chrome version: 56.0.2924.14  Channel: dev
OS Version: OS X 10.12.2
Flash Version: Shockwave Flash 24.0 r0

I was asked here: https://bugs.chromium.org/p/chromium/issues/detail?id=266674#c73 to fill a new report.  The core issue here is still the same, though: Chrome fails to respect the channel layout configured by the user.  In my case, this is a particularly nasty issue, because, as I noted in the other bug, I'm routing (macOS layout) channels 5/6 to a different audio device altogether, and the rear channels are mute for me as a result

As for a fix? I realize that this issue is somewhat complicated, as there are good use cases in the Web Audio API for freely mapping all channels on available interfaces - this is more about the default output mapping for media items in audio/video elements.
 
Showing comments 4 - 103 of 103 Older
Labels: TE-Hardware-Dependency

Comment 5 by spamc...@gmail.com, Dec 21 2016

It seems as though mono videos are being sent to channel 3 when being played on a multi-channel audio interface. Here's an example video that exhibits this behavior:

https://www.youtube.com/watch?v=0YIT9JSMqIo

I am using an Apogee Quartet with the latest firmware on macOS 10.12.1 and Chrome 55.0.2883.95 (64-bit)
Same issue here with latest chrome and Native Instruments Audio 6 Interface. Setup to stereo with output on channel B left/rigth and chrome still plays on Main left/right. 
But I have to say opera has the same problem, only safari has the right channel output.    

Comment 7 Deleted

Components: -Internals>Media Internals>Media>Audio
Owner: dalecur...@chromium.org
Status: Assigned (was: Unconfirmed)
Dale: Could you find an owner for this?
Cc: olka@chromium.org maxmorin@chromium.org hongchan@chromium.org
That's probably me unless someone from STO wants to take it. Otherwise I'll see about ordering one of these devices. +hongchan who might be interested too since I seem to recall him working on something like this for WebAUdio.

Comment 10 by olka@chromium.org, Jan 10 2017

Sorry Dale, we are overbooked with Mojo.
Blocking: 675787
Just adding my 2 cents to this. Chrome 55.0.2883.95 (64-bit), OSX 10.11.6, Apogee Quartet USB Audio Interface.

When using Chrome, videos with mono audio (from Facebook, YouTube, probably any HTML5 player) playback on Channel 3 of my audio device. This would be the correct behaviour if I had a 5.1 speaker setup, as channel 3 would be the centre (dialogue) speaker. However, I only have a 2.0 speaker setup (that is correctly configured in OSX settings) and so I can see that audio going to my device but there is no speaker connected to channel 3 for playback.

Comment 13 Deleted

At this stage you probably have enough data but I found this video https://www.youtube.com/watch?v=IYrdoQAjcww to create the same effect on my configuration. FYI, I have a Motu Microbook II and Chrome canary 58.0.3004.0 
Have a speculative CL to fix this, https://codereview.chromium.org/2683033003 but am waiting on testing from folk with discrete setups. I don't have one at this time. If anyone has a Chrome build environment and one of these cards patching that CL and seeing if it fixes your problem would be helpful!
Project Member

Comment 16 by bugdroid1@chromium.org, Feb 10 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/30068b4b24fc18a1a6473866dcc9a8ff28d4ec30

commit 30068b4b24fc18a1a6473866dcc9a8ff28d4ec30
Author: dalecurtis <dalecurtis@chromium.org>
Date: Fri Feb 10 19:39:44 2017

Tell CoreAudio how to interpret Chrome's channel layout.

Previously we always assumed the default layout which causes channels
to be mapped incorrectly if the user has manually assigned channels.

Instead, configure the AUHAL with our known channel layout, or in the
case of discrete the most likely layout so that macOS will remap the
channels in the appropriate order during playout.

BUG= 671308 , 675787 
TEST=5.1 virtual device configured with mixed channels plays the
correct order.
https://storage.googleapis.com/dalecurtis/dolby6.mp4
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2683033003
Cr-Commit-Position: refs/heads/master@{#449694}

[modify] https://crrev.com/30068b4b24fc18a1a6473866dcc9a8ff28d4ec30/media/audio/mac/audio_auhal_mac.cc
[modify] https://crrev.com/30068b4b24fc18a1a6473866dcc9a8ff28d4ec30/media/audio/mac/audio_auhal_mac.h
[modify] https://crrev.com/30068b4b24fc18a1a6473866dcc9a8ff28d4ec30/media/base/channel_layout.h

Tomorrow's Chrome Canary should have this issue fixed (the likely version will be 58.0.3009.0); please check it out and let me know if it resolves your issues.


Dale: I just tested with Canary, Version 58.0.3009.0 canary (64-bit), and I checked your commit was in it (https://storage.googleapis.com/chromium-find-releases-static/300.html#30068b4b24fc18a1a6473866dcc9a8ff28d4ec30)

I used the GITS trailer that I mentioned earlier (https://www.youtube.com/watch?v=IYrdoQAjcww) and on my Motu Microbook II it is not working properly. Actually nothing changed, the same behavior as before.

How could I help you debugging this?
jraoult: that's strange, does this happen on all videos or only that one?
Chrome Version 56.0.2924.87 (64-bit) on macOS 10.12.3. The GITS trailer video still outputs a on channel 3 of my Apogee Quartet interface.
sahejdhyan@ you need to install Chrome Canary to see this at present.
Dale: I saw this on other YT videos before and I wish I kept a ref to them. The GITS video is the only one I have right now. If I can find another one I'll post it here.

That said it works now but not sure it is related to your fix since I just tried in stable 56.0.2924.87 (64-bit) and it is fine there as well. I wonder if YT changed the encoding of the video in the meantime.
Yes please let me know if you see it again. If anyone else can confirm that canary fixes this issue we can get this fixed in the M57 stable update in a couple weeks.
Chrome canary Version 58.0.3012.0 canary (64-bit)
does not solve this issue. tested on twitter video ( https://twitter.com/skrillex/status/736328422901714944?lang=en )
and GITS trailer posted above
sahejdhyan@ thanks! Can you post the contents of chrome://media-internals when you try to play those videos?
Sure
media-internals (1).txt
7.8 KB View Download
Thanks, does this clip make a beeping noise on your setup?

http://storage.googleapis.com/dalecurtis/mse.html?src=sync1.mp3&type=mp3
Its not audible since its sending the signal to channel 3 but i'm using channel 1 & 2(stereo).
The interface has a display in which i can see the audio signal and the channel its sending to.
IN short NO
Thanks, it looks like we may be doing something wrong for clips which have mono audio. Let me see if I can put something together.

Comment 31 Deleted

sahejdhyan@ - can you post a picture of your channel configuration as seen by Audio MIDI Setup?
Screen Shot 2017-02-15 at 5.33.04 AM.png
127 KB View Download
Screen Shot 2017-02-15 at 5.33.21 AM.png
153 KB View Download
Thanks, one more thing, can you grab the chrome://media-internals data from the "streams" and "controllers" tabs? The json copy button unfortunately didn't grab that.
I don't see any of those tabs. i grabbed that from players tab
Nevermind found it
STREAM:
channel_layout: 7.1
channels: 8
component_id: 1
component_type: 2
device_id: AppleUSBAudioEngine:Apogee:Quartet:14200000:2,1
device_type: pcm_low_latency
effects: NO_EFFECTS
frames_per_buffer: 1024
owner_id: 0
sample_rate: 44100
status: started
volume: 1

Controller 2:3 properties
component_id: 3
component_type: 1
owner_id: 2
render_process_id: 8
web_contents_title: SKRILLEX on Twitter: "SORRY but we didnt steal this 🙏🏻 @justinbieber @bloodpop https://t.co/9897j9sfY7"
channel_layout: 7.1
channels: 8
device_id: default
device_type: pcm_low_latency
effects: NO_EFFECTS
frames_per_buffer: 1024
sample_rate: 44100
status: started

Ah, I see, this setup isn't triggering our discrete layout path since it has 8 channels. We thus assume it's a 7.1 layout and send the mono as a center channel only. I think instead of getting the channel count based on device channels, we should try to get the preferred layout:

https://developer.apple.com/library/content/technotes/tn2112/_index.html#//apple_ref/doc/uid/DTS10003282-CH1-SECTION4

This might return 2 instead of 8 when your device is configured in this manner and we'll properly mix out to stereo then. I'll see if I can put a sample app together tomorrow and upload it here to see what it reports.
The channel 7-8 are for headphones which the interface handles independently. That basically splits signal from 1-2 and 7-8
So technically it should be 5.1 since total of 6 outputs 
Dale: back on my MBP13'' laptotp (same Motu Microbook II) and I'm getting this again. So it seems a difference in the configurations of these two laptops produces a different outcome.

So I got the streams conf dump when playing the Skrillex video:

channel_layout: 7.1
channels: 8
component_id: 2
component_type: 2
device_id: com_motu_driver_MicroBookAudio_AudioEngine:000b1626
device_type: pcm_low_latency
effects: NO_EFFECTS
frames_per_buffer: 1024
owner_id: 0
sample_rate: 44100
status: started
volume: 1

And the controller:

channel_layout: 7.1
channels: 8
component_id: 4
component_type: 1
device_id: default
device_type: pcm_low_latency
effects: NO_EFFECTS
frames_per_buffer: 1024
owner_id: 3
sample_rate: 44100
status: started

I can identify the same reason you mentioned: the 7.1 layout in case of mono audio (for me routed by Chrome to Main 1 output instead of Aux 1 + 2).

Once I get an hand on my MPB 17'' I'll try to get a dump of the conf, may be it will tell us what is different
Screen Shot 2017-02-15 at 09.44.40.png
14.1 KB View Download
Okay, think I have a fix for this, https://codereview.chromium.org/2695633006 will hopefully land that tomorrow and have it in canary by Friday/Saturday.
Project Member

Comment 44 by bugdroid1@chromium.org, Feb 25 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d0beea4e2d9c11e6ab4f94eea91c4b6b87104a56

commit d0beea4e2d9c11e6ab4f94eea91c4b6b87104a56
Author: dalecurtis <dalecurtis@chromium.org>
Date: Sat Feb 25 00:45:23 2017

Use preferred channel layout on macOS instead of total channel count.

The old GetDeviceChannels() method returns the total number of channels
on a device, not necessarily how many its configured to use. For devices
which allocate ranges of channels to different behaviors (mirroring, etc)
this is completely broken.

Instead use kAudioDevicePropertyPreferredChannelLayout, which seems to
give us the right information in both the input and output cases. This
sometimes requires us to make an additional call to convert the given
information into something we can easily parse.

BUG= 671308 
TEST=manual; configure 6 channel virtual device as stereo.
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2695633006
Cr-Commit-Position: refs/heads/master@{#453023}

[modify] https://crrev.com/d0beea4e2d9c11e6ab4f94eea91c4b6b87104a56/media/audio/mac/audio_manager_mac.cc
[modify] https://crrev.com/d0beea4e2d9c11e6ab4f94eea91c4b6b87104a56/media/base/channel_layout.cc
[modify] https://crrev.com/d0beea4e2d9c11e6ab4f94eea91c4b6b87104a56/media/base/channel_layout.h

Dale: I wanted to test on Canary 58.0.3023.0 and with the video on this page: https://fast.wistia.net/embed/iframe/78j73pyz17 that is mono as well. But it seems like Canary is broken, any videos use a "fake device". FYI, I didn't passed any argument to do so.

Here's the stream/controller info:

channel_layout: MONO
channels: 1
component_id: 2
component_type: 1
device_id: default
device_type: pcm_low_latency
effects: NO_EFFECTS
frames_per_buffer: 1024
owner_id: 1
sample_rate: 44100
status: started


channel_layout: MONO
channels: 1
component_id: 1
component_type: 2
device_id: com_motu_driver_MicroBookAudio_AudioEngine:000b1626
device_type: fake
effects: NO_EFFECTS
frames_per_buffer: 1024
owner_id: 0
sample_rate: 44100
status: started
volume: 1

Do you think it is related to your changeset?

BTE, unrelated, but the "Human Verification" is so over the top. It takes me 1 to 3 mins every time I want to comment. The "finding store fronts" is a killer.

Yes it's possible this is my fault. What does Audio MIDI setup say about your device configuration?
Also is anyone else able to confirm that audio is broken for them on the latest canary? I will revert my patch set if so.
Dale: Here's a screenshot of my conf, nothing too different than in #c41
Screen Shot 2017-02-27 at 17.55.36.png
71.9 KB View Download
Thanks, do you have a configure speakers button? Or is it not available off the image anywhere?
Also can you report what the media-internals values are for this page:

http://storage.googleapis.com/dalecurtis/mse.html?src=sync1.mp3&type=mp3
Dale: Here we go, a screenshot of my speakers settings and the media internals values for the given page:

channel_layout: MONO
channels: 1
component_id: 1
component_type: 1
device_id: default
device_type: pcm_low_latency
effects: NO_EFFECTS
frames_per_buffer: 1024
owner_id: 1
sample_rate: 44100
status: started


channel_layout: MONO
channels: 1
component_id: 1
component_type: 2
device_id: com_motu_driver_MicroBookAudio_AudioEngine:000b1626
device_type: fake
effects: NO_EFFECTS
frames_per_buffer: 1024
owner_id: 0
sample_rate: 44100
status: stopped
volume: 1

Screen Shot 2017-02-27 at 18.16.13.png
35.0 KB View Download
Thanks, what about this one?

http://storage.googleapis.com/dalecurtis/dolby6.mp4
So for http://storage.googleapis.com/dalecurtis/dolby6.mp4:

channel_layout: 5.1_BACK
channels: 6
component_id: 1
component_type: 1
device_id: default
device_type: pcm_low_latency
effects: NO_EFFECTS
frames_per_buffer: 1024
owner_id: 7
sample_rate: 48000
status: started


channel_layout: 5.1_BACK
channels: 6
component_id: 0
component_type: 2
device_id: com_motu_driver_MicroBookAudio_AudioEngine:000b1626
device_type: fake
effects: NO_EFFECTS
frames_per_buffer: 1024
owner_id: 3
sample_rate: 48000
status: started
volume: 1

channel_layout: 5.1_BACK
channels: 6
component_id: 0
component_type: 2
device_id: com_motu_driver_MicroBookAudio_AudioEngine:000b1626
device_type: fake
effects: NO_EFFECTS
frames_per_buffer: 1024
owner_id: 3
sample_rate: 48000
status: stopped
volume: 1


Hmm, I can only guess that we're not getting a preferred channel layout returned for your device. I'll have to craft a small test program for you to check out since our local devices are working fine. I'll try to send something in the next couple hours.
jraoult@ can you try the following application from the terminal?

https://storage.googleapis.com/dalecurtis/media_unittests.zip

You can launch it like so:
./media_unittests --gtest_filter=MacAudioInputTest.AudioOutputTest

It should print out a bunch of info about the output system and try to play a 440Hz sine wave for 5 seconds, feel free to hit Ctrl-C during that part if it gets to there.

Sorry about sending a random binary, if you'd prefer to compile it yourself, this is the patch I wrote:
https://codereview.chromium.org/2718903003
Here's the output from my Macbook:

$ ./media_unittests  --gtest_filter=MacAudioInputTest.AudioOutputTest
IMPORTANT DEBUGGING NOTE: batches of tests are run inside their
own process. For debugging a test inside a debugger, use the
--gtest_filter=<your_test_name> flag along with
--single-process-tests.
Using sharding settings from environment. This is shard 0/1
Using 1 parallel jobs.
Note: Google Test filter = MacAudioInputTest.AudioOutputTest
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from MacAudioInputTest
[ RUN      ] MacAudioInputTest.AudioOutputTest
[27158:775:0227/141054.040027:4203334894862:ERROR:audio_manager_mac.cc(335)] Output total channels: 2
[27158:775:0227/141054.040636:4203335499390:ERROR:audio_manager_mac.cc(527)] Output channels: 2
[27158:775:0227/141054.040729:4203335572747:ERROR:audio_low_latency_input_mac_unittest.cc(292)] Params: format: 1 channel_layout: 3 channels: 2 sample_rate: 44100 bits_per_sample: 16 frames_per_buffer: 256 effects: 0 mic_positions: 
[27158:775:0227/141054.041023:4203335867576:ERROR:audio_manager_mac.cc(335)] Output total channels: 2
[27158:775:0227/141054.041279:4203336122035:ERROR:audio_manager_mac.cc(527)] Output channels: 2
[27158:775:0227/141054.041464:4203336307240:ERROR:audio_manager_mac.cc(335)] Output total channels: 2
[27158:775:0227/141054.041773:4203336617071:ERROR:audio_manager_mac.cc(527)] Output channels: 2
[       OK ] MacAudioInputTest.AudioOutputTest (5153 ms)
[----------] 1 test from MacAudioInputTest (5153 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (5153 ms total)
[  PASSED  ] 1 test.
[1/1] MacAudioInputTest.AudioOutputTest (5153 ms)
SUCCESS: all tests passed.
Tests took 5 seconds.

Dale: here's the result:

$ ./media_unittests  --gtest_filter=MacAudioInputTest.AudioOutputTest
IMPORTANT DEBUGGING NOTE: batches of tests are run inside their
own process. For debugging a test inside a debugger, use the
--gtest_filter=<your_test_name> flag along with
--single-process-tests.
Using sharding settings from environment. This is shard 0/1
Using 1 parallel jobs.
[1040:775:0227/222209.627861:257777301197240:ERROR:icu_util.cc(137)] icudtl.dat not found in bundle
[1040:775:0227/222209.627954:257777301280719:ERROR:icu_util.cc(173)] Invalid file descriptor to ICU data received.
Note: Google Test filter = MacAudioInputTest.AudioOutputTest
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from MacAudioInputTest
[ RUN      ] MacAudioInputTest.AudioOutputTest
[1040:775:0227/222209.724618:257777397948127:ERROR:audio_manager_mac.cc(335)] Output total channels: 8
[1040:775:0227/222209.724937:257777398264417:ERROR:audio_manager_mac.cc(527)] Output channels: 0
[1040:775:0227/222209.724964:257777398290074:ERROR:audio_low_latency_input_mac_unittest.cc(292)] Params: format: 1 channel_layout: 29 channels: 0 sample_rate: 44100 bits_per_sample: 16 frames_per_buffer: 256 effects: 0 mic_positions: 
[1040:775:0227/222209.725182:257777398510260:ERROR:audio_manager_mac.cc(335)] Output total channels: 8
[1040:775:0227/222209.725463:257777398790798:ERROR:audio_manager_mac.cc(527)] Output channels: 0
[1040:775:0227/222209.725495:257777398821232:ERROR:audio_manager_base.cc(257)] Invalid audio output parameters received; using fake audio path. Channels: 0, Sample Rate: 44100, Bits Per Sample: 16, Frames Per Buffer: 256
[1040:775:0227/222209.725543:257777398870125:ERROR:audio_manager_base.cc(137)] Audio parameters are invalid
../../media/audio/mac/audio_low_latency_input_mac_unittest.cc:298: Failure
Value of: stream->Open()
  Actual: false
Expected: true
[  FAILED  ] MacAudioInputTest.AudioOutputTest (94 ms)
[----------] 1 test from MacAudioInputTest (95 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (95 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] MacAudioInputTest.AudioOutputTest

 1 FAILED TEST
[1039:8967:0227/222209.761889:257777435230088:ERROR:kill_posix.cc(84)] Unable to terminate process group 1040: No such process
[1/1] MacAudioInputTest.AudioOutputTest (94 ms)
1 test failed:
    MacAudioInputTest.AudioOutputTest (../../media/audio/mac/audio_low_latency_input_mac_unittest.cc:290)
Tests took 0 seconds.
It gives that:

$ ./media_unittests\ 2  --gtest_filter=MacAudioInputTest.AudioOutputTest
IMPORTANT DEBUGGING NOTE: batches of tests are run inside their
own process. For debugging a test inside a debugger, use the
--gtest_filter=<your_test_name> flag along with
--single-process-tests.
Using sharding settings from environment. This is shard 0/1
Using 1 parallel jobs.
[4682:775:0227/223502.225190:258549865303165:ERROR:icu_util.cc(137)] icudtl.dat not found in bundle
[4682:775:0227/223502.225322:258549865422160:ERROR:icu_util.cc(173)] Invalid file descriptor to ICU data received.
Note: Google Test filter = MacAudioInputTest.AudioOutputTest
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from MacAudioInputTest
[ RUN      ] MacAudioInputTest.AudioOutputTest
[4682:775:0227/223502.319108:258549959210006:ERROR:audio_manager_mac.cc(335)] Output total channels: 8
[4682:775:0227/223502.319419:258549959519622:ERROR:audio_manager_mac.cc(523)] Counting! 8
[4682:775:0227/223502.319450:258549959547930:ERROR:audio_manager_mac.cc(526)] ch=0, 4294967295 (unknown)
[4682:775:0227/223502.319465:258549959563083:ERROR:audio_manager_mac.cc(526)] ch=1, 4294967295 (unknown)
[4682:775:0227/223502.319477:258549959574273:ERROR:audio_manager_mac.cc(526)] ch=2, 4294967295 (unknown)
[4682:775:0227/223502.319517:258549959616026:ERROR:audio_manager_mac.cc(526)] ch=3, 4294967295 (unknown)
[4682:775:0227/223502.319532:258549959629430:ERROR:audio_manager_mac.cc(526)] ch=4, 4294967295 (unknown)
[4682:775:0227/223502.319547:258549959646456:ERROR:audio_manager_mac.cc(526)] ch=5, 4294967295 (unknown)
[4682:775:0227/223502.319579:258549959679689:ERROR:audio_manager_mac.cc(526)] ch=6, 4294967295 (unknown)
[4682:775:0227/223502.319623:258549959722473:ERROR:audio_manager_mac.cc(526)] ch=7, 4294967295 (unknown)
[4682:775:0227/223502.319643:258549959740797:ERROR:audio_manager_mac.cc(536)] Output channels: 0
[4682:775:0227/223502.319657:258549959756199:ERROR:audio_low_latency_input_mac_unittest.cc(292)] Params: format: 1 channel_layout: 29 channels: 0 sample_rate: 44100 bits_per_sample: 16 frames_per_buffer: 256 effects: 0 mic_positions: 
[4682:775:0227/223502.319896:258549959995236:ERROR:audio_manager_mac.cc(335)] Output total channels: 8
[4682:775:0227/223502.320186:258549960284437:ERROR:audio_manager_mac.cc(523)] Counting! 8
[4682:775:0227/223502.320206:258549960303445:ERROR:audio_manager_mac.cc(526)] ch=0, 4294967295 (unknown)
[4682:775:0227/223502.320216:258549960313700:ERROR:audio_manager_mac.cc(526)] ch=1, 4294967295 (unknown)
[4682:775:0227/223502.320225:258549960322586:ERROR:audio_manager_mac.cc(526)] ch=2, 4294967295 (unknown)
[4682:775:0227/223502.320234:258549960332723:ERROR:audio_manager_mac.cc(526)] ch=3, 4294967295 (unknown)
[4682:775:0227/223502.320269:258549960368372:ERROR:audio_manager_mac.cc(526)] ch=4, 4294967295 (unknown)
[4682:775:0227/223502.320291:258549960388304:ERROR:audio_manager_mac.cc(526)] ch=5, 4294967295 (unknown)
[4682:775:0227/223502.320302:258549960400917:ERROR:audio_manager_mac.cc(526)] ch=6, 4294967295 (unknown)
[4682:775:0227/223502.320320:258549960418701:ERROR:audio_manager_mac.cc(526)] ch=7, 4294967295 (unknown)
[4682:775:0227/223502.320335:258549960431971:ERROR:audio_manager_mac.cc(536)] Output channels: 0
[4682:775:0227/223502.320364:258549960464517:ERROR:audio_manager_base.cc(257)] Invalid audio output parameters received; using fake audio path. Channels: 0, Sample Rate: 44100, Bits Per Sample: 16, Frames Per Buffer: 256
[4682:775:0227/223502.320404:258549960502141:ERROR:audio_manager_base.cc(137)] Audio parameters are invalid
../../media/audio/mac/audio_low_latency_input_mac_unittest.cc:297: Failure
Value of: stream->Open()
  Actual: false
Expected: true
[  FAILED  ] MacAudioInputTest.AudioOutputTest (91 ms)
[----------] 1 test from MacAudioInputTest (91 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (91 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] MacAudioInputTest.AudioOutputTest

 1 FAILED TEST
[4681:9987:0227/223502.357097:258549997210790:ERROR:kill_posix.cc(84)] Unable to terminate process group 4682: No such process
[1/1] MacAudioInputTest.AudioOutputTest (91 ms)
1 test failed:
    MacAudioInputTest.AudioOutputTest (../../media/audio/mac/audio_low_latency_input_mac_unittest.cc:290)
Tests took 0 seconds.
Hmm, that's unexpected. jraoult@ does this device work properly in Safari or Firefox with mono audio? I've looked over at least Firefox's code and they should be doing something similar here.

We're asking for the channel layout information and it returns a bunch of unknown channel positions; which means at best we can fall back to an 8 channel layout. OSX isn't telling us anything about your stereo layouts :/
Dale: So http://storage.googleapis.com/dalecurtis/dolby6.mp4 works in FF, with proper "left / right" balance. http://storage.googleapis.com/dalecurtis/mse.html?src=sync1.mp3&type=mp3 however is not even starting at all.
What about just http://storage.googleapis.com/dalecurtis/sync1.mp3 ? Does dolby6 work fine on Chrome Stable or Beta?
http://storage.googleapis.com/dalecurtis/sync1.mp3 works fine in FF stable 51.0.1 (64-bit) and Chrome stable 56.0.2924.87 (64-bit).

http://storage.googleapis.com/dalecurtis/dolby6.mp4 works fine in FF stable 51.0.1 (64-bit) and in Chrome stable 56.0.2924.87 (64-bit)

https://fast.wistia.net/embed/iframe/78j73pyz17 doesn't work fine in Chrome stable 56.0.2924.87 (64-bit). It is routed to channel 3 only instead of 1 and 2. It works fine in FF stable 51.0.1 (64-bit).

Seems that this last video as something different than the others that shows the problem.
FYI for this last video:

channel_layout: 7.1
channels: 8
component_id: 1
component_type: 1
device_id: default
device_type: pcm_low_latency
effects: NO_EFFECTS
frames_per_buffer: 1024
owner_id: 5118
sample_rate: 44100
status: started
render_process_id: 5530
web_contents_title: egghead-js-test-javascript-with-jest.mp4

channel_layout: 7.1
channels: 8
component_id: 87
component_type: 2
device_id: com_motu_driver_MicroBookAudio_AudioEngine:000b1626
device_type: pcm_low_latency
effects: NO_EFFECTS
frames_per_buffer: 1024
owner_id: 0
sample_rate: 44100
status: started
volume: 1
That should be the same as http://storage.googleapis.com/dalecurtis/mse.html?src=sync1.mp3&type=mp3 - it's mse w/ a mono source.

I've got a bug fix out for the canary issue, but that's just going to take us back to the same problem you have on stable. We may need to special case your device to stereo since it's not providing a channel layout. I'll also double check the docs to see if I've missed an API.
Yes indeed http://storage.googleapis.com/dalecurtis/mse.html?src=sync1.mp3&type=mp3 exposes the same behavior: routed to channel 3 instead of 1 and 2 in Chrome stable 
Project Member

Comment 67 by bugdroid1@chromium.org, Feb 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/408897d8dc0510887278a1f4210d51ba64cf898e

commit 408897d8dc0510887278a1f4210d51ba64cf898e
Author: dalecurtis <dalecurtis@chromium.org>
Date: Tue Feb 28 05:12:58 2017

Fix zero channel count being returned for unknown macOS layouts.

BUG= 671308 
TEST=none, based on user logs.
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2721633005
Cr-Commit-Position: refs/heads/master@{#453510}

[modify] https://crrev.com/408897d8dc0510887278a1f4210d51ba64cf898e/media/audio/mac/audio_manager_mac.cc

Dale: I think it was expected but FYI I just tested 408897d8 in 58.0.3027.0 and I still don't have sound for MSE generated mono audio stream:

channel_layout: MONO
channels: 1
component_id: 2
component_type: 2
device_id: com_motu_driver_MicroBookAudio_AudioEngine:000b1626
device_type: fake
effects: NO_EFFECTS
frames_per_buffer: 1024
owner_id: 0
sample_rate: 44100
status: started
volume: 1
Yes, that's expected. I wrote my other fixes assuming you device had a channel layout as reported by the OS.

I'm not sure what to do about the lack of one yet; possibly we can just always force stereo in this case... Will investigate more later this week and see if there's another sample app I can provide.

There's another layout property, but we can't retrieve it until we've opened the device... which is a bit late given our use case.

https://developer.apple.com/reference/audiotoolbox/1534199-generic_audio_unit_properties/kaudiounitproperty_audiochannellayout?language=objc

Will see if there's a way to use that.
jraoult@, sorry for the delay, it's been a busy month. Can you try the following application from the terminal with the same command line and post the results?

https://storage.googleapis.com/dalecurtis/media_unittests3.zip

./media_unittests --gtest_filter=MacAudioInputTest.AudioOutputTest
Dale: no worries, good to get some news from you.

Here are the results. Seems promising, the sound was playing on both speakers.

./media_unittests --gtest_filter=MacAudioInputTest.AudioOutputTest
IMPORTANT DEBUGGING NOTE: batches of tests are run inside their
own process. For debugging a test inside a debugger, use the
--gtest_filter=<your_test_name> flag along with
--single-process-tests.
Using sharding settings from environment. This is shard 0/1
Using 1 parallel jobs.
[68540:775:0323/090606.562886:181498926543342:ERROR:icu_util.cc(137)] icudtl.dat not found in bundle
[68540:775:0323/090606.563030:181498926672542:ERROR:icu_util.cc(173)] Invalid file descriptor to ICU data received.
Note: Google Test filter = MacAudioInputTest.AudioOutputTest
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from MacAudioInputTest
[ RUN      ] MacAudioInputTest.AudioOutputTest
[68540:775:0323/090606.671494:181499035138347:ERROR:audio_manager_mac.cc(335)] Output total channels: 8
[68540:775:0323/090606.671821:181499035463667:ERROR:audio_manager_mac.cc(538)] Unable to use channel layout for channel count, trying AU.
[68540:775:0323/090606.703205:181499066849382:ERROR:audio_manager_mac.cc(586)] Output channels: 2
[68540:775:0323/090606.703294:181499066937877:ERROR:audio_low_latency_input_mac_unittest.cc(292)] Params: format: 1 channel_layout: 3 channels: 2 sample_rate: 44100 bits_per_sample: 16 frames_per_buffer: 256 effects: 0 mic_positions: 
[68540:775:0323/090606.703609:181499067251137:ERROR:audio_manager_mac.cc(335)] Output total channels: 8
[68540:775:0323/090606.703879:181499067520605:ERROR:audio_manager_mac.cc(538)] Unable to use channel layout for channel count, trying AU.
[68540:775:0323/090606.706555:181499070197148:ERROR:audio_manager_mac.cc(586)] Output channels: 2
[68540:775:0323/090606.706748:181499070388874:ERROR:audio_manager_mac.cc(335)] Output total channels: 8
[68540:775:0323/090606.707076:181499070719757:ERROR:audio_manager_mac.cc(538)] Unable to use channel layout for channel count, trying AU.
[68540:775:0323/090606.709667:181499073310449:ERROR:audio_manager_mac.cc(586)] Output channels: 2
[       OK ] MacAudioInputTest.AudioOutputTest (5177 ms)
[----------] 1 test from MacAudioInputTest (5177 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (5177 ms total)
[  PASSED  ] 1 test.
[1/1] MacAudioInputTest.AudioOutputTest (5177 ms)
SUCCESS: all tests passed.
Tests took 5 seconds.

Great to hear! I'll clean that up and try to get it submitted today or tomorrow.
Project Member

Comment 73 by bugdroid1@chromium.org, Mar 29 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5285d00f561827da882c8faaa7bda1d571c4fc60

commit 5285d00f561827da882c8faaa7bda1d571c4fc60
Author: dalecurtis <dalecurtis@chromium.org>
Date: Wed Mar 29 00:27:30 2017

Use AudioUnit instead of AudioDevice properties to get channel count.

On some devices kAudioDevicePropertyPreferredChannelLayout is not available
or lists the channel types as unknown. kAudioUnitProperty_AudioChannelLayout
instead seems to always be set and correct, so use it instead.

To do this, I've introduced a new helper class ScopedAudioUnit which helps
with the allocation and deallocation of AudioUnits. In a followup patch set
I'll convert the input and output streams to use this new mechanism.

BUG= 671308 ,  675787 
TEST=user verified success.
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2771093002
Cr-Commit-Position: refs/heads/master@{#460250}

[modify] https://crrev.com/5285d00f561827da882c8faaa7bda1d571c4fc60/media/audio/BUILD.gn
[modify] https://crrev.com/5285d00f561827da882c8faaa7bda1d571c4fc60/media/audio/mac/audio_auhal_mac.cc
[modify] https://crrev.com/5285d00f561827da882c8faaa7bda1d571c4fc60/media/audio/mac/audio_manager_mac.cc
[modify] https://crrev.com/5285d00f561827da882c8faaa7bda1d571c4fc60/media/audio/mac/audio_manager_mac.h
[add] https://crrev.com/5285d00f561827da882c8faaa7bda1d571c4fc60/media/audio/mac/scoped_audio_unit.cc
[add] https://crrev.com/5285d00f561827da882c8faaa7bda1d571c4fc60/media/audio/mac/scoped_audio_unit.h

jraoult.developer@ can you please try the latest Chrome Canary to see if your issue is resolved? 59.0.3055.0 or higher will have the above fix.
Confirming the issue fixed on chrome canary 49.0.3055.3 w/ apogee quartet.
Thanks for the fix!
*59.0.3055.3
Great! It's unfortunately a big change to how we do channel count selection on OSX, so it'll need to soak a while on M59 to see if it's stable enough to merge to M58. I'll keep an eye on our error rates.
Cc: dalecur...@chromium.org
 Issue 675787  has been merged into this issue.
@dale: yep, confirming the fix as well. Thanks for your dedication here. I know  edge cases like that can be cumbersome to handle.

Anyway, can't wait for it to land. I get my ears destroyed every time there is a mono source since it is bypassing the gain control as well :)
Labels: -M-56 M-59
Great! Marking as fixed for M59 currently and will update if we merge.
Cc: -dalecur...@chromium.org
Status: Fixed (was: Assigned)
Also, always happy to help! Glad you can finally use your devices correctly with Chrome :)

Comment 82 Deleted

Verified that Mono audio tracks on video now come through channels 1/2 with:
 - Chrome Canary 59.0.3056.0
 - Native Instruments Komplete Audio 6 Soundcard 
 - Mac OS 10.10.5
 - Stereo layout in Audio/MIDI Setup

Thank you! Hoping this gets into stable soon.
Labels: Merge-Request-58
Per UMA metrics and crash reports there's been no adverse affects reported from this change, so lets go ahead and merge to 58.
Project Member

Comment 86 by sheriffbot@chromium.org, Apr 12 2017

Labels: -Merge-Request-58 Merge-Review-58 Hotlist-Merge-Review
This bug requires manual review: We are only 12 days from stable.
Please contact the milestone owner if you have questions.
Owners: amineer@(Android), cmasso@(iOS), bhthompson@(ChromeOS), govind@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Looks like this is well tested in Canary. However, I don't see any unit tests added. Can you please confirm if this change is well tested with unit tests?
Yes, it touches a hot path, so it's tested via every test that creates an audio input or output streams and runs on macOS (hundreds of tests) and millions of daily dev/canary hits. We have some specific unit tests which create streams and they all are functioning correctly too.
Labels: -Merge-Review-58 Merge-Rejected-58
Thanks - realizing this is well tested and covered by unit tests, my recommendation is to wait until M59. We're very close to M58 Stable promotion and this hasn't been tested yet in Beta. Rejecting this for M58 and let's aim for M59.
Hello, I seem to have the issue that was reportedly fixed above. I'm running 65.0.3325.181 64-bit official build in High Sierra with a MOTU Audio Express (8 channel output). 

This GITS trailer only plays only through channel 3:
https://www.youtube.com/watch?v=IYrdoQAjcww
...And this one plays through channels 1-2:
https://www.youtube.com/watch?v=G4VmJcZR0Yg

This issue exists for me on YouTube, FB, Twitter, etc.

I attached my log from media_unittests3. I see a failed file check in there, but I was able to hear the sine wave on all channels. 

Dale, sorry to comment on an old issue, and thank you for all your previous efforts to fix this for other. If you have any ideas that might help me, I'd be grateful.
media_unittests.log
2.7 KB View Download
Is this broken again for anyone else in M65? I don't think there have been any changes to this code since the last fix.

@senseirrf, can you run the unittest with the following command line:

./media_unittests  --gtest_filter=MacAudioInputTest.AudioOutputTest
Thanks so much Dale.
Sine wave OK on all channels, here's what I got (log attached):

IMPORTANT DEBUGGING NOTE: batches of tests are run inside their
own process. For debugging a test inside a debugger, use the
--gtest_filter=<your_test_name> flag along with
--single-process-tests.
Using sharding settings from environment. This is shard 0/1
Using 1 parallel jobs.
[5816:775:0413/141101.196899:11368318997271:ERROR:icu_util.cc(137)] icudtl.dat not found in bundle
[5816:775:0413/141101.197292:11368319136895:ERROR:icu_util.cc(173)] Invalid file descriptor to ICU data received.
Note: Google Test filter = MacAudioInputTest.AudioOutputTest
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from MacAudioInputTest
[ RUN      ] MacAudioInputTest.AudioOutputTest
[5816:775:0413/141101.264734:11368386584479:ERROR:audio_manager_mac.cc(335)] Output total channels: 8
[5816:775:0413/141101.265003:11368386850921:ERROR:audio_manager_mac.cc(586)] Output channels: 6
[5816:775:0413/141101.265037:11368386882973:ERROR:audio_low_latency_input_mac_unittest.cc(292)] Params: format: 1 channel_layout: 10 channels: 6 sample_rate: 44100 bits_per_sample: 16 frames_per_buffer: 256 effects: 0 mic_positions: 
[5816:775:0413/141101.265223:11368387070825:ERROR:audio_manager_mac.cc(335)] Output total channels: 8
[5816:775:0413/141101.265515:11368387372083:ERROR:audio_manager_mac.cc(586)] Output channels: 6
[5816:775:0413/141101.265699:11368387545942:ERROR:audio_manager_mac.cc(335)] Output total channels: 8
[5816:775:0413/141101.265993:11368387839772:ERROR:audio_manager_mac.cc(586)] Output channels: 6
[       OK ] MacAudioInputTest.AudioOutputTest (5117 ms)
[----------] 1 test from MacAudioInputTest (5117 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (5117 ms total)
[  PASSED  ] 1 test.
[1/1] MacAudioInputTest.AudioOutputTest (5117 ms)
SUCCESS: all tests passed.
Tests took 5 seconds.
media_unittests.log
1.0 KB View Download
@senseirrf how is your device configured in Audio Midi Setup? What happens in Safari or other browsers? Since your device is reporting 6 channels, we assume it's 5.1 (notably, we do tell CoreAudio the channel labels too, so it should be remapping as appropriate).

What is your expected behavior?
Config screenshots are attached. In the stereo configuration, the main outputs and headphones should be playing a stereo mix. 

On the MOTU, the 8 output channels are:
Main Out 1/2
Analog 1/2
S/PDIF 1/2
Phones 1/2

The headphone channels can be set to monitor any of the other channels, I generally have it set to Main 1/2, but for the shorter GTIS trailer above, I have to manually switch the output to Analog 1/2 and I only get the left side (channel 3).

It works correctly in Firefox- I can leave it on Main Out 1/2 and hear everything.
The last time I tried Safari (a few weeks ago) it worked correctly, but I just now tried it again and it's now exhibiting the same issue. 
Screen Shot 2018-04-13 at 2.23.32 PM.png
98.4 KB View Download
Screen Shot 2018-04-13 at 2.24.21 PM.png
83.2 KB View Download
Thanks, what happens with this link in Firefox: 
http://storage.googleapis.com/dalecurtis/sync1.mp3


I hear the beeps in both Firefox and Chrome with the Main Out 1/2. In Safari I had to switch to Analog 1/2 and only heard it on channel 3.
Okay and what does http://storage.googleapis.com/dalecurtis/dolby6.mp4 do in all the browsers?
Same result in all browsers: Front left/right on ch1/2 (Main Out 1/2), center on ch3 and LFE on channel 4 (Analog 1/2), rear left/right on ch5/6 (S/PDIF). 

Is that what you expect to happen or did you want it downmixed to stereo?

The reason you see issues with mono and MSE in Chrome is that we must upmix to the highest supported channel layout in case the audio stream switches to > source channels. It seems all browsers are detecting your device as having 6 output channels instead of 2, since Safari is even doing this, there may not be a way for us to detect this properly.
For the Dolby test it makes perfect sense to hear all 6 channels, but when using headphones, the goal would be not to have to manually switch the output channels to hear both of those GTIS trailers. Another example- CNN goes to one set of outputs, Fox News goes to another. In Firefox, it all goes to channels 1/2 (except in the Dolby test), so there's no manual switching needed.

Again, I greatly appreciate your time with this.
I believe the Firefox case only works because they don't seamless support output channel count changes in MSE (or do so with glitches).

Why your device is presenting as 6 channels I'm not sure. Many folks in this thread seem to have a similar device in a similar configuration (at least AFAICT from the screenshots) but when Chrome queries the channel layout with their device it only receives 2 channels instead of 6.

Hence it'll be interesting to see if any of the original reporters on this bug are seeing issues again. I'd guess it'd mean there was a macOS or Moto update which has changed something since we haven't touched this code since the bug fix AFAICT.
I just tried different speaker configurations, then changed it back to exactly what you see in the screenshots above, and now it DOES seem to report 2 channels. Both Chrome and Safari are now mixing everything to stereo (including the Dolby test, only missing the LFE). Firefox is now ignoring everything beyond ch1/2. And the MOTU audio setup app just crashed. So yeah, this is starting to smell like High Sierra/MOTU compatibility issues... and that means I'll stop wasting your time. 

Thanks again for your help and for making Chrome as great as it is. Enjoy the weekend!
Great happy to hear!
Showing comments 4 - 103 of 103 Older

Sign in to add a comment