• Xiaohan Wang's avatar
    media: Support NewKeyCB registration in CdmContext · a80616b7
    Xiaohan Wang authored
    All players/decoders handling encrypted media should implement the logic
    to suspend playback when the decryption key is not available, and then
    resume playback when a new usable decryption key is added. Hence,
    there's a common need for the players/decoders to be notified when such
    an event (new usable key) happens.
    
    Since CdmContext is the common interface bridging players/decoders and
    the CDM, this CL adds RegisterNewKeyCB() to CdmContext.
    
    To facilitate the implementation of RegisterNewKeyCB() in various CDMs
    and CdmProxies, CallbackRegistry is also introduced, which can manage
    callback registration, notification and unregistration. Note that
    there's base::CallbackList which is similar, but that class is not as
    simple and is not thread-safe.
    
    This CL also updates D3D11CdmProxy to use CallbackRegistry to manage
    new key callbacks. D3D11VideoDecoderImpl is also updated to be able to
    register new key callbacks.
    
    Bug: 821288
    Test: Covered by existing tests.
    Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
    Change-Id: I0380f934efb63d3b3c893d909e0d78f5f8e082f4
    Reviewed-on: https://chromium-review.googlesource.com/1014245
    Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
    Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#551468}
    a80616b7
d3d11_video_decoder_impl.cc 12.9 KB