• Matt Wolenetz's avatar
    MSE-in-Workers: Do MSE media element track mgmt via attachments · 562812e0
    Matt Wolenetz authored
    Instead of manipulating the media element's audio and video tracks
    directly from the SourceBuffer, this change moves that into the
    MediaSourceAttachmentSupplement interface.
    
    Currently, TrackBase and TrackListBase usage by HTMLMediaElement and
    SourceBuffer require ownership and operation by the main thread, and
    further require knowledge of the main-thread-owned media element for
    use in scheduling events on the main thread. For cross-thread MSE-in-
    Workers attachments, to prevent regressing BackgroundVideoOptimization,
    the media element will need knowledge of the worker-MSE audio and video
    track identifications used by the underlying media pipeline.
    
    This change supports future signalling of the media element to add or
    remove such audio and video tracks via new methods in
    MediaSourceAttachmentSupplement. Existing same-thread behavior is
    maintained by new implementations of these methods in the
    SameThreadMediaSourceAttachment. SourceBuffer is updated to understand
    which of the methods to use, as until track ownership and operation
    in worker context is supported, workarounds in SourceBuffer and the
    attachment will be needed.
    
    Later changes will include the cross-thread attachment implementation
    of the media-element track addition and removal to actually perform
    the signalling.
    
    This change retains the pre-existing experimental AudioVideoTracks
    ability of MSE in Chrome for same-thread-attachments, but prevents
    (with a CHECK failure, since IDL prohibits alternatives) retrieval by
    the app of a SourceBuffer's audioTracks or videoTracks when the MSE is
    in a worker context.
    
    BUG=878133
    
    Change-Id: I209ce61915de2e4182807539013606322ece8f67
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2427566Reviewed-by: default avatarWill Cassella <cassew@google.com>
    Commit-Queue: Matthew Wolenetz <wolenetz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#812984}
    562812e0
source_buffer.cc 70.1 KB