Commit 14d3a4a1 authored by Raymond Toy's avatar Raymond Toy Committed by Commit Bot

Sort tracks by id in MediaStreamAudioSourceNode

When there are multiple tracks in a MediaStreamAudioSourceNode, the
track to use is the first track after sorting the tracks based on a
lexicographic ordering of the track ids using code unit values.

Feature: https://www.chromestatus.com/feature/5749997033226240

Bug: 984994, 983790
Change-Id: I0c194caa98de1f0283927dc0206219ab7679c86d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1706775Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarHongchan Choi <hongchan@chromium.org>
Commit-Queue: Raymond Toy <rtoy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681066}
parent ad77da0e
......@@ -142,8 +142,14 @@ MediaStreamAudioSourceNode* MediaStreamAudioSourceNode::Create(
return nullptr;
}
// Use the first audio track in the media stream.
// Find the first track, which is the track whose id comes first given a
// lexicographic ordering of the code units of the track id.
MediaStreamTrack* audio_track = audio_tracks[0];
for (auto track : audio_tracks) {
if (CodeUnitCompareLessThan(track->id(), audio_track->id())) {
audio_track = track;
}
}
std::unique_ptr<AudioSourceProvider> provider =
audio_track->CreateWebAudioSource(context.sampleRate());
......
......@@ -2220,7 +2220,6 @@ crbug.com/987224 virtual/cascade/external/wpt/css/css-paint-api/idlharness.html
### sheriff 2019-07-16
crbug.com/983799 [ Win ] http/tests/navigation/redirect-on-back-updates-history-item.html [ Timeout Pass ]
crbug.com/983799 [ Win ] virtual/blink-cors/http/tests/navigation/redirect-on-back-updates-history-item.html [ Timeout Pass ]
crbug.com/983790 external/wpt/webaudio/the-audio-api/the-mediastreamaudiosourcenode-interface/mediastreamaudiosourcenode-routing.html [ Pass Failure Timeout ]
crbug.com/983789 [ Win7 ] http/tests/cookies/js-set-null.html [ Pass Failure ]
crbug.com/983788 http/tests/cookies/http-get-cookie-set-in-js.html [ Pass Failure ]
crbug.com/983788 http/tests/cookies/same-site/popup-cross-site.html [ Pass Timeout ]
......
This is a testharness.js-based test.
FAIL MediaStreamAudioSourceNode captures the right track. assert_true: Other track seem to be routed to the AudioContext? expected true got false
Harness: the test ran to completion.
......@@ -57,6 +57,8 @@
const twoTrackSource = ac.createMediaStreamSource(twoTrackMediaStream);
const analyser = ac.createAnalyser();
// Don't do smoothing so that the frequency data changes quickly
analyser.smoothingTimeConstant = 0;
twoTrackSource.connect(analyser);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment