Associating Audio Streams to Tabs

957 views
Skip to first unread message

George A

unread,
Oct 28, 2023, 12:18:20 AM10/28/23
to media-dev
Hello, I have a use case in which I need to associate audio to a specific tab. I tried to add a new field to media::AudioParameters that is passed into the ForwardingAudioStreamFactory::CreateOutputStream that belongs to the WebContents, but it seems like by the time it gets to the AudioManager it seems like the AudioParameters have been stripped. 

Is there a more straightforward way to do this? It is unclear to me how these classes communicate directly as there's a lot of Mojo, but I don't see where the AudioParameters are being dropped.

Dale Curtis

unread,
Oct 30, 2023, 4:11:08 PM10/30/23
to George A, media-dev
I'm not entirely sure of your use case, but you'd probably want to check the serializer for AudioParameters:

On Fri, Oct 27, 2023 at 9:18 PM George A <geoad...@gmail.com> wrote:
Hello, I have a use case in which I need to associate audio to a specific tab. I tried to add a new field to media::AudioParameters that is passed into the ForwardingAudioStreamFactory::CreateOutputStream that belongs to the WebContents, but it seems like by the time it gets to the AudioManager it seems like the AudioParameters have been stripped. 

Is there a more straightforward way to do this? It is unclear to me how these classes communicate directly as there's a lot of Mojo, but I don't see where the AudioParameters are being dropped.

--
You received this message because you are subscribed to the Google Groups "media-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to media-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/media-dev/aec4209a-6f59-4ce3-9f55-c0cbf6247786n%40chromium.org.

mark a. foltz

unread,
Jan 8, 2024, 4:36:08 PM1/8/24
to Dale Curtis, George A, media-dev
The way output streams are normally associated with tabs is through a group_id that is passed into the audio service when the stream is created.  This group_id can be used later to mute or capture audio from a specific tab.    The group_id is assigned in the browser for each WebContents (tab) in the ForwardingAudioStreamFactory.

If you want to operate on groups of streams from the same tab in the browser, consider extending the stream group APIs in the audio service instead of plumbing knowledge of things like tabs into lower levels of the media stack.

m.

Reply all
Reply to author
Forward
0 new messages