Changeset 250918 in webkit


Ignore:
Timestamp:
Oct 9, 2019 11:10:11 AM (5 years ago)
Author:
eric.carlson@apple.com
Message:

[ Mac WK2 ] Layout Test fast/mediastream/MediaStreamTrack-getSettings.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=196400
<rdar://problem/49567579>

Reviewed by Youenn Fablet.

Source/WebCore:

No new tests, this fixes a broken test.

  • platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
  • platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:

(WebCore::MockRealtimeAudioSourceMac::reconfigure): Reconfigure buffers as well.
(WebCore::MockRealtimeAudioSourceMac::render): Call reconfigure if the buffer isn't
configured correctly.
(WebCore::MockRealtimeAudioSourceMac::settingsDidChange): Call reconfigure.

  • platform/mock/MockRealtimeAudioSource.cpp:

(WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource): Set sample rate to default.

LayoutTests:

  • fast/mediastream/MediaStreamTrack-getSettings.html: Cleanup test.
  • platform/mac-wk2/TestExpectations: Unskip test.
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r250917 r250918  
     12019-10-09  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [ Mac WK2 ] Layout Test fast/mediastream/MediaStreamTrack-getSettings.html is a flaky failure
     4        https://bugs.webkit.org/show_bug.cgi?id=196400
     5        <rdar://problem/49567579>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        * fast/mediastream/MediaStreamTrack-getSettings.html: Cleanup test.
     10        * platform/mac-wk2/TestExpectations: Unskip test.
     11
    1122019-10-09  Dean Jackson  <dino@apple.com>
    213
  • trunk/LayoutTests/fast/mediastream/MediaStreamTrack-getSettings.html

    r193389 r250918  
    55        <script src="./resources/getUserMedia-helper.js"></script>
    66        <script>
    7             var mediaStream;
    8             var track;
     7            let track;
    98
    109            function limitPrecision(value, precision)
     
    1514            }
    1615           
     16            function forEachNativeProperty(list, func)
     17            {
     18                for (let property in list) {
     19                    if (list.hasOwnProperty(property, list[property]) || list.__proto__.hasOwnProperty(property))
     20                        func(property, list[property]);
     21                }
     22            }
     23           
    1724            function listTrackSettings(track)
    1825            {
    1926                debug(`${track.kind} track settings:`);
    20                 settings = track.getSettings();
    21                 for (var property in settings) {
    22                     if (settings.hasOwnProperty(property) || settings.__proto__.hasOwnProperty(property)) {
    23                         if (property == "deviceId")
    24                             value = "&lt;UUID>";
    25                         else
    26                             value = limitPrecision(settings[property], 3);
    27                         debug(`  settings.${property} = ${value}`);
    28                     }
    29                 }
     27                forEachNativeProperty(track.getSettings(), (property, value) => {
     28                    if (property == "deviceId")
     29                        value = "&lt;UUID>";
     30                    else
     31                        value = limitPrecision(value, 3);
     32                    debug(`  settings.${property} = ${value}`);
     33                });
    3034
    3135                debug("");
     
    3539            {
    3640                track = t;
    37 
    38                 capabilities = track.getCapabilities();
    39                 settings = track.getSettings();
    40                 for (var property in settings) {
    41                     if (settings.hasOwnProperty(property) || settings.__proto__.hasOwnProperty(property)) {
    42                         shouldBeTrue(`"${property}" in track.getCapabilities()`);
    43                     }
    44                 }
     41                forEachNativeProperty(track.getSettings(), (property, value) => {
     42                    shouldBeTrue(`"${property}" in track.getCapabilities()`);
     43                });
    4544            }
    4645
    47             function gotStream(stream)
     46            async function start()
    4847            {
    49                 mediaStream = stream;
     48                description("Tests MediaStreamTrack.getSettings.");
     49                let stream = await navigator.mediaDevices.getUserMedia({audio:true, video:true});
    5050
    51                 listTrackSettings(mediaStream.getVideoTracks()[0]);
    52                 listTrackSettings(mediaStream.getAudioTracks()[0]);
     51                listTrackSettings(stream.getVideoTracks()[0]);
     52                listTrackSettings(stream.getAudioTracks()[0]);
    5353
    5454                debug('According to the spec: "[every setting] MUST be a member of the set defined for that property by getCapabilities()"<br>');
    55                 checkTrackSettings(mediaStream.getVideoTracks()[0]);
    56                 checkTrackSettings(mediaStream.getAudioTracks()[0]);
     55                checkTrackSettings(stream.getVideoTracks()[0]);
     56                checkTrackSettings(stream.getAudioTracks()[0]);
    5757                finishJSTest();
    58             }
    59 
    60             function start()
    61             {
    62                 description("Tests MediaStreamTrack.getSettings.");
    63                 getUserMedia("allow", {audio:true, video:true}, gotStream);
    6458            }
    6559
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r250589 r250918  
    908908webkit.org/b/194916 fast/mediastream/MediaStream-video-element.html [ Pass Failure ]
    909909
    910 webkit.org/b/196400 fast/mediastream/MediaStreamTrack-getSettings.html [ Pass Failure ]
    911 
    912910webkit.org/b/196403 imported/w3c/web-platform-tests/mediacapture-record/MediaRecorder-stop.html [ Pass Failure ]
    913911
  • trunk/Source/WebCore/ChangeLog

    r250916 r250918  
     12019-10-09  Eric Carlson  <eric.carlson@apple.com>
     2
     3        [ Mac WK2 ] Layout Test fast/mediastream/MediaStreamTrack-getSettings.html is a flaky failure
     4        https://bugs.webkit.org/show_bug.cgi?id=196400
     5        <rdar://problem/49567579>
     6
     7        Reviewed by Youenn Fablet.
     8
     9        No new tests, this fixes a broken test.
     10
     11        * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
     12        * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
     13        (WebCore::MockRealtimeAudioSourceMac::reconfigure): Reconfigure buffers as well.
     14        (WebCore::MockRealtimeAudioSourceMac::render): Call reconfigure if the buffer isn't
     15        configured correctly.
     16        (WebCore::MockRealtimeAudioSourceMac::settingsDidChange): Call reconfigure.
     17
     18        * platform/mock/MockRealtimeAudioSource.cpp:
     19        (WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource): Set sample rate to default.
     20
    1212019-10-09  Chris Dumez  <cdumez@apple.com>
    222
  • trunk/Source/WebCore/platform/mediastream/mac/MockRealtimeAudioSourceMac.mm

    r248846 r250918  
    124124{
    125125    ASSERT(!isMainThread());
    126     m_maximiumFrameCount = WTF::roundUpToPowerOfTwo(renderInterval().seconds() * sampleRate() * 2);
     126
     127    auto rate = sampleRate();
     128    ASSERT(rate);
     129
     130    m_maximiumFrameCount = WTF::roundUpToPowerOfTwo(renderInterval().seconds() * rate * 2);
    127131    ASSERT(m_maximiumFrameCount);
    128132
     
    133137    const bool isBigEndian = false;
    134138    const bool isNonInterleaved = true;
    135     FillOutASBDForLPCM(m_streamFormat, sampleRate(), channelCount, bitsPerByte * bytesPerFloat, bitsPerByte * bytesPerFloat, isFloat, isBigEndian, isNonInterleaved);
     139    FillOutASBDForLPCM(m_streamFormat, rate, channelCount, bitsPerByte * bytesPerFloat, bitsPerByte * bytesPerFloat, isFloat, isBigEndian, isNonInterleaved);
    136140
    137141    m_audioBufferList = makeUnique<WebAudioBufferList>(m_streamFormat, m_streamFormat.mBytesPerFrame * m_maximiumFrameCount);
     
    140144    CMAudioFormatDescriptionCreate(NULL, &m_streamFormat, 0, NULL, 0, NULL, NULL, &formatDescription);
    141145    m_formatDescription = adoptCF(formatDescription);
     146
     147    size_t sampleCount = 2 * rate;
     148    m_bipBopBuffer.resize(sampleCount);
     149    m_bipBopBuffer.fill(0);
     150
     151    size_t bipBopSampleCount = ceil(BipBopDuration * rate);
     152    size_t bipStart = 0;
     153    size_t bopStart = rate;
     154
     155    addHum(BipBopVolume, BipFrequency, rate, 0, m_bipBopBuffer.data() + bipStart, bipBopSampleCount);
     156    addHum(BipBopVolume, BopFrequency, rate, 0, m_bipBopBuffer.data() + bopStart, bipBopSampleCount);
    142157}
    143158
     
    145160{
    146161    ASSERT(!isMainThread());
    147     if (!m_audioBufferList)
     162    if (!m_audioBufferList || !m_bipBopBuffer.size())
    148163        reconfigure();
    149164
     
    174189    if (settings.contains(RealtimeMediaSourceSettings::Flag::SampleRate)) {
    175190        m_workQueue->dispatch([this, protectedThis = makeRef(*this)] {
    176             m_formatDescription = nullptr;
    177             m_audioBufferList = nullptr;
    178 
    179             auto rate = sampleRate();
    180             size_t sampleCount = 2 * rate;
    181 
    182             m_bipBopBuffer.grow(sampleCount);
    183             m_bipBopBuffer.fill(0);
    184 
    185             size_t bipBopSampleCount = ceil(BipBopDuration * rate);
    186             size_t bipStart = 0;
    187             size_t bopStart = rate;
    188 
    189             addHum(BipBopVolume, BipFrequency, rate, 0, m_bipBopBuffer.data() + bipStart, bipBopSampleCount);
    190             addHum(BipBopVolume, BopFrequency, rate, 0, m_bipBopBuffer.data() + bopStart, bipBopSampleCount);
     191            reconfigure();
    191192        });
    192193    }
  • trunk/Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp

    r248046 r250918  
    6969    ASSERT(device);
    7070    m_device = *device;
     71
     72    setSampleRate(WTF::get<MockMicrophoneProperties>(m_device.properties).defaultSampleRate);
    7173}
    7274
Note: See TracChangeset for help on using the changeset viewer.