• Sergey Ulanov's avatar
    [Fuchsia] Cleanup locking logic in FuchsiaAudioRenderer. · 19d94ea9
    Sergey Ulanov authored
    FuchsiaAudioRenderer implements TimeSource. That interface must be
    thread-safe, so the fields used in the implementation are protected
    with a lock. This CL contains the following fixes for the related code:
     1. Renamed state_lock_ to timeline_lock_: the lock is used for fields
        other than state_.
     2. Added SetPlaybackState(), which helps to ensure that state_ is
        mutated only on the main thread.
     3. Added GetPlaybackState(). It returns current state_ without
        acquiring the lock. This allows to avoid the lock in some cases.
     4. Fixed a DCHECK in FlushInternal() to allow kEndOfStream. That
        DCHECK was failing previously, see linked bug.
    
    Bug: 1035635
    Change-Id: I44077a0310635d3136873fb99093290ae74c8806
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2033928Reviewed-by: default avatarDavid Dorwin <ddorwin@chromium.org>
    Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
    Auto-Submit: Sergey Ulanov <sergeyu@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#738096}
    19d94ea9
fuchsia_audio_renderer.h 6.34 KB