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

Unified Diff: content/renderer/media/android/webmediaplayer_android.cc

Issue 605013002: Refactor MediaSourceDelegate destruction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mp4_stream_parser_hack
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/android/webmediaplayer_android.cc
diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc
index 27e2c1d8e698bd11d66049ff033363b72e5f3011..8de6f4ebb88cecfd5f0c99c4649d85ea8826b146 100644
--- a/content/renderer/media/android/webmediaplayer_android.cc
+++ b/content/renderer/media/android/webmediaplayer_android.cc
@@ -201,6 +201,16 @@ WebMediaPlayerAndroid::~WebMediaPlayerAndroid() {
delegate_->PlayerGone(this);
stream_texture_factory_->RemoveObserver(this);
+
+ if (media_source_delegate_) {
+ // Part of |media_source_delegate_| needs to be stopped on the media thread.
+ // Wait until |media_source_delegate_| is fully stopped before tearing
+ // down other objects.
+ base::WaitableEvent waiter(false, false);
+ media_source_delegate_->Stop(
+ base::Bind(&base::WaitableEvent::Signal, base::Unretained(&waiter)));
qinmin 2014/09/26 18:06:50 How about moving this waitableEvent into MediaSour
xhwang 2014/09/26 21:06:57 My Clank checkout is broken.. I'll land this CL as
+ waiter.Wait();
+ }
}
void WebMediaPlayerAndroid::load(LoadType load_type,

Powered by Google App Engine
This is Rietveld 408576698