• Matt Wolenetz's avatar
    MSE-in-Workers: Add modules-specific attachment interface · f2465478
    Matt Wolenetz authored
    Adds a supplemental interface in modules to extend the core
    MediaSourceAttachment, so common methods in specialized attachments can
    be defined without requiring them known by core. This reduces complexity
    of the core side of the attachment interface.
    
    Specifically, adds MediaSourceAttachmentSupplement, with a new method
    (implemented in concrete SameThreadMediaSourceAttachment) to notify the
    attached element that the duration of the resource has changed. Later
    specialization in a cross-thread version of the attachment will need to
    perform this notification asynchronously.
    
    Lifts the Unregister() method and the persistent MediaSource OilPan
    reference member from the concrete implementation into this common
    modules attachment supplement's implementation, since these are expected
    to remain the same across all concrete attachment implementations.
    
    Updates SameThreadMediaSourceAttachment to give the MediaSource a
    thread-safe refcounted scoped_refptr for the attachment during
    StartAttachingToMediaElement(). MediaSource, like HTMLMediaElement does
    already, is updated to know both the attachment and the
    MediaSourceTracer while the attachment is active.
    
    Starts using NotifyDurationChanged from the MediaSource object via the
    attachment instead of directly talking to the attached media element
    from the MediaSource.
    
    Further extensions of this attachment interface will come in later
    changes for similar scenarios, eventually enabling the dropping of the
    |attached_element_| member from the MediaSource class, with all
    interactions on the element eventually done via the attachment.
    
    BUG=878133
    
    Change-Id: I86206f740b62f9ba6dc6a1b9fd16a44aff21f49a
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2387121Reviewed-by: default avatarWill Cassella <cassew@google.com>
    Commit-Queue: Matthew Wolenetz <wolenetz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#804434}
    f2465478
media_source.h 6.94 KB