• Yuri Wiitala's avatar
    AudioService: Fixes for loopback underruns/timing issues. · 4f9a19f1
    Yuri Wiitala authored
    Fixes a "choppy audio" issue on platforms with certain audio timing
    parameters/scenarios. Investigation on crbug.com/934770 led to the
    realization that three related problems needed to be addressed:
    
    1. Fix the "gap" detection in audio::SnooperNode to check in BOTH
    directions, not just one direction; and on both the input and output
    flows. This accounts for the case where a device-switch in
    audio::OutputController results in a sudden drastic shift in the delay
    timestamps.
    
    2. Add automatically-increasing capture delay logic to
    audio::LoopbackStream to ensure the reads from all nodes' delay buffer
    will never result in underrun.
    
    3. Increased the accuracy of media::FakeAudioWorker/OutputStream by: a)
    addressing a subtle source of error in task scheduling delay math due to
    integer truncation; b) exposing timestamps to worker callbacks that
    allow FakeAudioOutputStream to provide a |delay| and |delay_timestamp|
    that behaves just like a real AudioOutputStream. This "lessens the blow"
    of a device-switch to SnooperNode.
    
    Bug: 934770
    Change-Id: Ia75f18b2be3ad905f27d6ad882df9632764bb81c
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1504981
    Commit-Queue: Yuri Wiitala <miu@chromium.org>
    Reviewed-by: default avatarMax Morin <maxmorin@chromium.org>
    Reviewed-by: default avatarOskar Sundbom <ossu@chromium.org>
    Reviewed-by: default avatarWeiyong Yao <braveyao@chromium.org>
    Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#638427}
    4f9a19f1
fake_audio_output_stream.h 1.86 KB