Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(863)

Issue 1407933010: media: Make MediaKeys ref-counted. (Closed)

Created:
5 years, 1 month ago by xhwang
Modified:
5 years, 1 month ago
CC:
chromium-reviews, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, posciak+watch_chromium.org, nasko+codewatch_chromium.org, yzshen+watch_chromium.org, ben+mojo_chromium.org, mlamouri+watch-media_chromium.org, lcwu+watch_chromium.org, jam, abarth-chromium, eme-reviews_chromium.org, darin-cc_chromium.org, halliwell+watch_chromium.org, mlamouri+watch-content_chromium.org, creis+watch_chromium.org, feature-media-reviews_chromium.org, gunsch+watch_chromium.org, avayvod+watch_chromium.org, mcasas+watch_chromium.org, Aaron Boodman, mkwst+moarreviews-renderer_chromium.org, darin (slow to review)
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

media: Make MediaKeys ref-counted. MediaKeys (CDM) is created and owned by the EME stack (e.g. CdmSessionAdapter) but is dereferenced by the media pipeline (e.g. DecryptingVideoDecoder). During teardown, we need to make sure the CDM is not dereferenced by the media pipeline after it's destructed. In the Render process, this is guaranteed by the order of destruction of MediaKeys and Media elements in the Blink layer. However, when the CDM and the media pipeline are running out-of-process, because the order of IPC messages on different IPC channels is nondeterministic, we need some extra mechanism to ensure that the media pipeline doesn't dereference a destructed CDM. Currently on Android, this is achieved by using an extra PlayerTracker interface. However, in some situations, e.g. when the media pipeline and CDM are running on different threads, the destruction handling code could be pretty complicated. When a MojoMediaApplication is hosted in a non-Render process, we face the same issue. Starting with this CL, we'll make MediaKeys ref-counted, so that the media pipeline that uses it will also hold a ref-count to it. This will greatly simplify the lifetime management between the CDM and the media pipeline. BUG=511040 TEST=All existing use cases still work. Committed: https://crrev.com/b24facba10f213d4448bf108ba0d01821b2ba05d Cr-Commit-Position: refs/heads/master@{#357514}

Patch Set 1 #

Total comments: 17

Patch Set 2 : ReleaseSoon on ChromeCast and drop cdm_unset_cb on Android #

Patch Set 3 : Address timav@'s comments. #

Total comments: 21

Patch Set 4 : comments addressed #

Total comments: 6

Patch Set 5 : comments addressed #

Patch Set 6 : rebase only #

Unified diffs Side-by-side diffs Delta from patch set Stats (+463 lines, -519 lines) Patch
M chromecast/browser/media/cast_browser_cdm_factory.h View 3 chunks +3 lines, -3 lines 0 comments Download
M chromecast/browser/media/cast_browser_cdm_factory.cc View 3 chunks +7 lines, -7 lines 0 comments Download
M chromecast/browser/media/cma_message_filter_host.cc View 1 2 2 chunks +4 lines, -7 lines 0 comments Download
M chromecast/media/cdm/browser_cdm_cast.h View 1 6 chunks +16 lines, -16 lines 0 comments Download
M chromecast/media/cdm/browser_cdm_cast.cc View 1 2 3 4 5 2 chunks +7 lines, -15 lines 0 comments Download
M content/browser/media/android/media_drm_credential_manager.h View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/media/android/media_drm_credential_manager.cc View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/media/cdm/browser_cdm_manager.h View 4 chunks +5 lines, -5 lines 0 comments Download
M content/browser/media/cdm/browser_cdm_manager.cc View 15 chunks +26 lines, -29 lines 0 comments Download
M content/browser/media/media_web_contents_observer.cc View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/render_process_host_impl.h View 1 2 3 4 5 1 chunk +2 lines, -2 lines 0 comments Download
M content/browser/renderer_host/render_process_host_impl.cc View 1 2 3 4 5 1 chunk +3 lines, -2 lines 0 comments Download
M content/public/browser/render_process_host.h View 2 chunks +5 lines, -5 lines 0 comments Download
M content/public/test/mock_render_process_host.h View 1 chunk +2 lines, -2 lines 0 comments Download
M content/public/test/mock_render_process_host.cc View 2 chunks +7 lines, -2 lines 0 comments Download
M content/renderer/media/crypto/ppapi_decryptor.h View 2 chunks +2 lines, -2 lines 0 comments Download
M content/renderer/media/crypto/ppapi_decryptor.cc View 1 chunk +6 lines, -7 lines 0 comments Download
M content/renderer/media/crypto/proxy_media_keys.h View 2 chunks +2 lines, -2 lines 0 comments Download
M content/renderer/media/crypto/proxy_media_keys.cc View 2 chunks +11 lines, -13 lines 0 comments Download
M content/renderer/media/crypto/render_cdm_factory.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M media/base/BUILD.gn View 1 2 3 4 5 1 chunk +0 lines, -2 lines 0 comments Download
M media/base/android/browser_cdm_factory_android.h View 1 chunk +1 line, -1 line 0 comments Download
M media/base/android/browser_cdm_factory_android.cc View 4 chunks +7 lines, -7 lines 0 comments Download
M media/base/android/media_codec_player.h View 1 2 4 chunks +5 lines, -6 lines 0 comments Download
M media/base/android/media_codec_player.cc View 1 2 3 6 chunks +23 lines, -42 lines 0 comments Download
M media/base/android/media_drm_bridge.h View 1 2 10 chunks +32 lines, -33 lines 0 comments Download
M media/base/android/media_drm_bridge.cc View 1 2 3 4 5 12 chunks +54 lines, -74 lines 0 comments Download
M media/base/android/media_drm_bridge_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M media/base/android/media_player_android.h View 2 chunks +2 lines, -2 lines 0 comments Download
M media/base/android/media_player_android.cc View 1 chunk +1 line, -1 line 0 comments Download
M media/base/android/media_source_player.h View 1 2 3 chunks +4 lines, -5 lines 0 comments Download
M media/base/android/media_source_player.cc View 1 2 6 chunks +21 lines, -28 lines 0 comments Download
D media/base/browser_cdm.h View 1 chunk +0 lines, -40 lines 0 comments Download
D media/base/browser_cdm.cc View 1 chunk +0 lines, -20 lines 0 comments Download
M media/base/browser_cdm_factory.h View 1 2 3 2 chunks +6 lines, -5 lines 0 comments Download
M media/base/browser_cdm_factory.cc View 2 chunks +3 lines, -3 lines 0 comments Download
M media/base/cdm_factory.h View 1 chunk +1 line, -1 line 0 comments Download
M media/base/cdm_initialized_promise.h View 1 2 3 3 chunks +5 lines, -3 lines 0 comments Download
M media/base/cdm_initialized_promise.cc View 1 chunk +5 lines, -5 lines 0 comments Download
M media/base/media_keys.h View 1 2 3 4 6 chunks +53 lines, -9 lines 0 comments Download
M media/base/media_keys.cc View 1 chunk +9 lines, -0 lines 0 comments Download
M media/base/player_tracker.h View 1 chunk +2 lines, -1 line 0 comments Download
M media/blink/cdm_session_adapter.h View 2 chunks +2 lines, -2 lines 0 comments Download
M media/blink/cdm_session_adapter.cc View 2 chunks +5 lines, -6 lines 0 comments Download
M media/cdm/aes_decryptor.h View 2 chunks +2 lines, -1 line 0 comments Download
M media/cdm/aes_decryptor_unittest.cc View 13 chunks +27 lines, -27 lines 0 comments Download
M media/cdm/default_cdm_factory.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M media/cdm/player_tracker_impl.h View 2 chunks +7 lines, -6 lines 0 comments Download
M media/cdm/player_tracker_impl.cc View 2 chunks +25 lines, -17 lines 0 comments Download
M media/cdm/ppapi/external_clear_key/clear_key_cdm.h View 1 chunk +1 line, -1 line 0 comments Download
M media/cdm/ppapi/external_clear_key/clear_key_cdm.cc View 8 chunks +12 lines, -13 lines 0 comments Download
M media/cdm/proxy_decryptor.h View 1 2 3 3 chunks +3 lines, -2 lines 0 comments Download
M media/cdm/proxy_decryptor.cc View 3 chunks +3 lines, -3 lines 0 comments Download
M media/media.gyp View 1 2 3 4 5 1 chunk +0 lines, -2 lines 0 comments Download
M media/mojo/services/mojo_cdm.h View 1 2 3 4 5 2 chunks +2 lines, -2 lines 0 comments Download
M media/mojo/services/mojo_cdm.cc View 1 2 3 4 5 1 chunk +6 lines, -7 lines 0 comments Download
M media/mojo/services/mojo_cdm_service.h View 1 2 3 4 5 3 chunks +3 lines, -2 lines 0 comments Download
M media/mojo/services/mojo_cdm_service.cc View 1 2 3 4 5 2 chunks +2 lines, -2 lines 0 comments Download
M media/test/pipeline_integration_test.cc View 1 2 3 5 chunks +13 lines, -11 lines 0 comments Download

Messages

Total messages: 33 (5 generated)
xhwang
This CL is touching a lot of files since I am updating a base media/EME ...
5 years, 1 month ago (2015-10-28 20:39:58 UTC) #2
gunsch
Drive-by review comments. I like the idea in principle, though I'm mildly concerned about the ...
5 years, 1 month ago (2015-10-28 20:51:01 UTC) #3
gunsch
I talked with xhwang@ a bit offline. I think this is less big of a ...
5 years, 1 month ago (2015-10-28 22:10:33 UTC) #4
xhwang
https://chromiumcodereview.appspot.com/1407933010/diff/1/chromecast/media/cdm/browser_cdm_cast.cc File chromecast/media/cdm/browser_cdm_cast.cc (right): https://chromiumcodereview.appspot.com/1407933010/diff/1/chromecast/media/cdm/browser_cdm_cast.cc#newcode81 chromecast/media/cdm/browser_cdm_cast.cc:81: player_tracker_impl_->NotifyCdmUnset(); On 2015/10/28 22:10:33, gunsch wrote: > I'm a ...
5 years, 1 month ago (2015-10-28 22:33:22 UTC) #5
Tima Vaisburd
So far just nits. May be some are not even relevant after your cleanup. https://chromiumcodereview.appspot.com/1407933010/diff/1/media/base/android/media_codec_player.cc ...
5 years, 1 month ago (2015-10-28 22:49:40 UTC) #6
Tima Vaisburd
https://chromiumcodereview.appspot.com/1407933010/diff/1/media/base/android/media_drm_bridge.cc File media/base/android/media_drm_bridge.cc (right): https://chromiumcodereview.appspot.com/1407933010/diff/1/media/base/android/media_drm_bridge.cc#newcode422 media/base/android/media_drm_bridge.cc:422: task_runner_->DeleteSoon(FROM_HERE, this)) { Why did you prefer potentially calling ...
5 years, 1 month ago (2015-10-28 23:42:17 UTC) #7
xhwang
I addressed gunsch and timav's comments. PTAL again. https://chromiumcodereview.appspot.com/1407933010/diff/1/chromecast/media/cdm/browser_cdm_cast.cc File chromecast/media/cdm/browser_cdm_cast.cc (right): https://chromiumcodereview.appspot.com/1407933010/diff/1/chromecast/media/cdm/browser_cdm_cast.cc#newcode81 chromecast/media/cdm/browser_cdm_cast.cc:81: player_tracker_impl_->NotifyCdmUnset(); ...
5 years, 1 month ago (2015-10-29 00:17:28 UTC) #8
Tima Vaisburd
https://chromiumcodereview.appspot.com/1407933010/diff/40001/media/base/android/media_codec_player.cc File media/base/android/media_codec_player.cc (right): https://chromiumcodereview.appspot.com/1407933010/diff/40001/media/base/android/media_codec_player.cc#newcode441 media/base/android/media_codec_player.cc:441: // No need to set |cdm_unset_cb| since |this| holds ...
5 years, 1 month ago (2015-10-29 01:17:53 UTC) #9
xhwang
https://chromiumcodereview.appspot.com/1407933010/diff/40001/media/base/android/media_codec_player.cc File media/base/android/media_codec_player.cc (right): https://chromiumcodereview.appspot.com/1407933010/diff/40001/media/base/android/media_codec_player.cc#newcode441 media/base/android/media_codec_player.cc:441: // No need to set |cdm_unset_cb| since |this| holds ...
5 years, 1 month ago (2015-10-29 03:12:31 UTC) #10
gunsch
I agree with xhwang's description. It seems like this hinges on not being able to ...
5 years, 1 month ago (2015-10-29 16:01:29 UTC) #12
Tima Vaisburd
lgtm for android part % please add comments
5 years, 1 month ago (2015-10-29 17:10:01 UTC) #13
jrummell
lgtm w/nits. https://codereview.chromium.org/1407933010/diff/40001/media/base/android/media_codec_player.cc File media/base/android/media_codec_player.cc (right): https://codereview.chromium.org/1407933010/diff/40001/media/base/android/media_codec_player.cc#newcode416 media/base/android/media_codec_player.cc:416: DCHECK(cdm); Should this DCHECK() be first to ...
5 years, 1 month ago (2015-10-29 21:05:17 UTC) #14
halliwell
https://chromiumcodereview.appspot.com/1407933010/diff/40001/chromecast/browser/media/cma_message_filter_host.cc File chromecast/browser/media/cma_message_filter_host.cc (right): https://chromiumcodereview.appspot.com/1407933010/diff/40001/chromecast/browser/media/cma_message_filter_host.cc#newcode122 chromecast/browser/media/cma_message_filter_host.cc:122: base::Unretained(browser_cdm_cast))); On 2015/10/29 16:01:29, gunsch wrote: > TODO(halliwell) to ...
5 years, 1 month ago (2015-10-30 01:50:51 UTC) #15
xhwang
https://chromiumcodereview.appspot.com/1407933010/diff/40001/chromecast/media/cdm/browser_cdm_cast.cc File chromecast/media/cdm/browser_cdm_cast.cc (right): https://chromiumcodereview.appspot.com/1407933010/diff/40001/chromecast/media/cdm/browser_cdm_cast.cc#newcode166 chromecast/media/cdm/browser_cdm_cast.cc:166: task_runner_->ReleaseSoon(FROM_HERE, raw_cdm); On 2015/10/30 01:50:51, halliwell wrote: > Seems ...
5 years, 1 month ago (2015-10-30 04:50:16 UTC) #16
halliwell
On 2015/10/30 04:50:16, xhwang wrote: > https://chromiumcodereview.appspot.com/1407933010/diff/40001/chromecast/media/cdm/browser_cdm_cast.cc > File chromecast/media/cdm/browser_cdm_cast.cc (right): > > https://chromiumcodereview.appspot.com/1407933010/diff/40001/chromecast/media/cdm/browser_cdm_cast.cc#newcode166 > ...
5 years, 1 month ago (2015-10-30 05:14:16 UTC) #17
xhwang
comments addressed
5 years, 1 month ago (2015-10-30 16:19:39 UTC) #18
xhwang
https://chromiumcodereview.appspot.com/1407933010/diff/40001/media/base/android/media_codec_player.cc File media/base/android/media_codec_player.cc (right): https://chromiumcodereview.appspot.com/1407933010/diff/40001/media/base/android/media_codec_player.cc#newcode416 media/base/android/media_codec_player.cc:416: DCHECK(cdm); On 2015/10/29 21:05:17, jrummell wrote: > Should this ...
5 years, 1 month ago (2015-10-30 16:20:59 UTC) #19
xhwang
All comments addressed. nasko: Please OWNERS review trivial changes in: content/browser/renderer_host/render_process_host_impl.* content/public/browser/render_process_host.h content/public/test/mock_render_process_host.* ddorwin: Please ...
5 years, 1 month ago (2015-10-30 16:25:20 UTC) #21
xhwang
nasko / ddorwin: kindly ping :)
5 years, 1 month ago (2015-11-02 18:15:22 UTC) #22
nasko
*render_process_host* LGTM
5 years, 1 month ago (2015-11-02 21:46:58 UTC) #23
ddorwin
I mainly looked at media_keys.h. LG. Some nits. https://chromiumcodereview.appspot.com/1407933010/diff/60001/media/base/media_keys.h File media/base/media_keys.h (right): https://chromiumcodereview.appspot.com/1407933010/diff/60001/media/base/media_keys.h#newcode37 media/base/media_keys.h:37: // ...
5 years, 1 month ago (2015-11-03 00:28:50 UTC) #24
xhwang
comments addressed
5 years, 1 month ago (2015-11-03 00:50:07 UTC) #25
xhwang
https://chromiumcodereview.appspot.com/1407933010/diff/60001/media/base/media_keys.h File media/base/media_keys.h (right): https://chromiumcodereview.appspot.com/1407933010/diff/60001/media/base/media_keys.h#newcode37 media/base/media_keys.h:37: // An interface for the Content Decryption Module (CDM) ...
5 years, 1 month ago (2015-11-03 00:50:29 UTC) #26
ddorwin
LG. Thanks.
5 years, 1 month ago (2015-11-03 00:52:17 UTC) #27
xhwang
rebase only
5 years, 1 month ago (2015-11-03 01:07:45 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1407933010/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1407933010/100001
5 years, 1 month ago (2015-11-03 01:26:56 UTC) #31
commit-bot: I haz the power
Committed patchset #6 (id:100001)
5 years, 1 month ago (2015-11-03 02:09:37 UTC) #32
commit-bot: I haz the power
5 years, 1 month ago (2015-11-03 02:10:22 UTC) #33
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/b24facba10f213d4448bf108ba0d01821b2ba05d
Cr-Commit-Position: refs/heads/master@{#357514}

Powered by Google App Engine
This is Rietveld 408576698