Skip to content

Commit

Permalink
[Docs] Updates media/capture docs: Debug logs for WebRTC Web APIs
Browse files Browse the repository at this point in the history
Change-Id: Ia5fb0186b4ebe0624838a06bd3f8a4ccbbdb4534
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4790361
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Commit-Queue: Henrik Andreasson <henrika@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1185115}
  • Loading branch information
henrikand authored and Chromium LUCI CQ committed Aug 18, 2023
1 parent b808bef commit c219341
Showing 1 changed file with 51 additions and 5 deletions.
56 changes: 51 additions & 5 deletions docs/media/capture/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,29 +155,75 @@ Allows the user to switch the camera/microphone used for capture via an icon in

# APIs

## getUserMedia()
## [getUserMedia()](https://rawgit.com/w3c/mediacapture-main/master/getusermedia.html)

Web API for Web applications to capture camera and microphone input.

* Code
* `//third_party/blink/renderer/modules/mediastream/`
* `//third_party/blink/renderer/platform/webrtc/`
* Issues
* `Blink>GetUserMedia`
* [`Blink>GetUserMedia`](https://bugs.chromium.org/p/chromium/issues/list?q=component%3ABlink%3EGetUserMedia&can=2)
* Docs
* To be added later.


## getDisplayMedia()
## [getDisplayMedia()](https://w3c.github.io/mediacapture-screen-share/)

Web API for Web applications to capture screen contents and system/tab audio.

* Code
* `//third_party/blink/renderer/modules/mediastream/`
* Issues
* `Blink>GetDisplayMedia`
* [`Blink>GetDisplayMedia`](https://bugs.chromium.org/p/chromium/issues/list?q=component%3ABlink%3EGetDisplayMedia&can=2)
* Docs
* To be added later.

# Logs

Usage of the APIs above involves several media layers in Chrome and can contain
both audio and video streams. Logs from the most essential classes are
centralized and all pass through:
* [`content/browser/renderer_host/media/media_stream_manager.cc`](https://source.chromium.org/chromium/chromium/src/+/main:content/browser/renderer_host/media/media_stream_manager.cc), and
* [`third_party/blink/renderer/platform/webrtc/webrtc_logging.cc`](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/webrtc/webrtc_logging.cc)

It is possible to view these logs by adding special log filters (using a local
Chromium build in this example):
```
./out/Default/chrome --enable-logging --vmodule=*/content/browser/renderer_host/media/*=1,*/third_party/blink/renderer/platform/webrtc/*=1
```

Each log line is prepended with a tag corresponding to an abbreviation of the
class which generated the log. E.g. `UMP::` for `UserMediaProcessor`, `PLAS::`
for `ProcessedLocalAudioSource`, `AIC::` for `AudioInputController`, `AMB::` for
`AudioManagerBase` etc. The tags enable post processing of the captured logs to
analyze how a web client uses specified classes or modules in Chrome.

The example below is from a [WebRTC demo client](https://webrtc.github.io/samples/src/content/getusermedia/audio/) which uses `getUserMedia` to captures audio and then render it locally:

```
less ./out/Default/chrome_debug.log | grep 'UMP'
[11460:25180:0817/133550.056:VERBOSE1:webrtc_logging.cc(35)] UMP::ProcessRequest({request_id=0}, {audio=1}, {video=0})
[11460:25180:0817/133550.056:VERBOSE1:webrtc_logging.cc(35)] UMP::SetupAudioInput({request_id=0}, {constraints=})
[11460:25180:0817/133550.056:VERBOSE1:webrtc_logging.cc(35)] UMP::SetupAudioInput({request_id=0}) => (Requesting device capabilities)
[11460:25180:0817/133550.843:VERBOSE1:webrtc_logging.cc(35)] UMP::SelectAudioSettings({request_id=0})
[11460:25180:0817/133550.853:VERBOSE1:webrtc_logging.cc(35)] UMP::GenerateStreamForCurrentRequestInfo({request_id=0}, {audio.device_id=default}, {video.device_id=})
[11460:25180:0817/133550.911:VERBOSE1:webrtc_logging.cc(35)] UMP::OnStreamsGenerated({request_id=0}, {label=b24a1017-a129-4465-b1fa-f4d9c553d956}, {device=[id: default, name: Default - Microphone (Realtek(R) Audio)]})
[11460:25180:0817/133550.911:VERBOSE1:webrtc_logging.cc(35)] UMP::StartTracks({request_id=0}, {label=b24a1017-a129-4465-b1fa-f4d9c553d956})
[11460:25180:0817/133550.913:VERBOSE1:webrtc_logging.cc(35)] UMP::CreateAudioTrack({render_to_associated_sink=0})
[11460:25180:0817/133550.913:VERBOSE1:webrtc_logging.cc(35)] UMP::InitializeAudioSourceObject({session_id=4FF8214D8180F02B8A9206564C59C03D})
[11460:25180:0817/133550.914:VERBOSE1:webrtc_logging.cc(35)] UMP::CreateAudioSource => (audiprocessing is required)
[11460:25180:0817/133550.922:VERBOSE1:webrtc_logging.cc(35)] UMP::StartAudioTrack({track=[id: 9803bb62-5cdc-4279-b58e-fd1193d7ecd8, enabled: 1]}, {is_pending=1})
[11460:25180:0817/133550.922:VERBOSE1:webrtc_logging.cc(35)] UMP::StartAudioTrack(source: {session_id=4FF8214D8180F02B8A9206564C59C03D}, {is_local_source=1}, {device=[id: default, group_id: def1842e91c7bc3d9c2be5618262afa5413975edb13d4a33c266224daed0a478, name: Default - Microphone (Realtek(R) Audio)]})
[11460:25180:0817/133551.330:VERBOSE1:webrtc_logging.cc(35)] UMP::OnTrackStarted({session_id=4FF8214D8180F02B8A9206564C59C03D}, {result=OK})
[11460:25180:0817/133551.330:VERBOSE1:webrtc_logging.cc(35)] UMP::UMP::OnCreateNativeTracksCompleted({request_id=0}, {label=b24a1017-a129-4465-b1fa-f4d9c553d956})
[11460:25180:0817/133551.330:VERBOSE1:webrtc_logging.cc(35)] UMP::GetUserMediaRequestSucceeded({request_id=0})
[11460:25180:0817/133551.331:VERBOSE1:webrtc_logging.cc(35)] UMP::DelayedGetUserMediaRequestSucceeded({request_id=0}, {result=OK})
[11460:25180:0817/133553.114:VERBOSE1:webrtc_logging.cc(35)] UMP::OnDeviceStopped({session_id=4FF8214D8180F02B8A9206564C59C03D}, {device_id=default})
[11460:25180:0817/133553.115:VERBOSE1:webrtc_logging.cc(35)] UMP::StopLocalSource({session_id=4FF8214D8180F02B8A9206564C59C03D})
[11460:25180:0817/133553.123:VERBOSE1:webrtc_logging.cc(35)] UMP::RemoveLocalSource({id=default}, {name=Default - Microphone (Realtek(R) Audio)}, {group_id=def1842e91c7bc3d9c2be5618262afa5413975edb13d4a33c266224daed0a478})
```

# Additional features

Not all media capture features are listed above; here are some additional
Expand Down

0 comments on commit c219341

Please sign in to comment.