• Chris Cunningham's avatar
    Audio|VideoDecoderBroker: more weakptr, keep callbacks on main thread. · 3514ff91
    Chris Cunningham authored
    Using unretained for decoder/selector callbacks is generally not safe /
    fragile. For ex, some decoders (e.g. those that offload) will call the
    output callback after destruction. Another example: decoder selector
    internally posts the Select() callback, so it may run after destruction.
    
    Additionally, sending incoming callbacks as CrossThreadFunctions for
    invoking on the media thread is not safe. We may destruct while some
    callbacks are still pending, destroying the callbacks internal state
    (including bindings to blink GC types) off the main thread. Now we
    ensure that all callbacks are saved on the main thread and we extend
    the "client" interfaces of the broker for proxying the callbacks safely.
    
    Bug: 1120431
    
    Change-Id: I2ccfe46982cda9b18e47a56424b25f54f8877883
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2366661
    Commit-Queue: Chrome Cunningham <chcunningham@chromium.org>
    Auto-Submit: Chrome Cunningham <chcunningham@chromium.org>
    Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#800776}
    3514ff91
decoder_template.cc 15.4 KB