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

Side by Side 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, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/android/webmediaplayer_android.h" 5 #include "content/renderer/media/android/webmediaplayer_android.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/android/build_info.h" 9 #include "base/android/build_info.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 194
195 { 195 {
196 base::AutoLock auto_lock(current_frame_lock_); 196 base::AutoLock auto_lock(current_frame_lock_);
197 current_frame_ = NULL; 197 current_frame_ = NULL;
198 } 198 }
199 199
200 if (delegate_) 200 if (delegate_)
201 delegate_->PlayerGone(this); 201 delegate_->PlayerGone(this);
202 202
203 stream_texture_factory_->RemoveObserver(this); 203 stream_texture_factory_->RemoveObserver(this);
204
205 if (media_source_delegate_) {
206 // Part of |media_source_delegate_| needs to be stopped on the media thread.
207 // Wait until |media_source_delegate_| is fully stopped before tearing
208 // down other objects.
209 base::WaitableEvent waiter(false, false);
210 media_source_delegate_->Stop(
211 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
212 waiter.Wait();
213 }
204 } 214 }
205 215
206 void WebMediaPlayerAndroid::load(LoadType load_type, 216 void WebMediaPlayerAndroid::load(LoadType load_type,
207 const blink::WebURL& url, 217 const blink::WebURL& url,
208 CORSMode cors_mode) { 218 CORSMode cors_mode) {
209 DCHECK(main_thread_checker_.CalledOnValidThread()); 219 DCHECK(main_thread_checker_.CalledOnValidThread());
210 media::ReportMediaSchemeUma(GURL(url)); 220 media::ReportMediaSchemeUma(GURL(url));
211 221
212 switch (load_type) { 222 switch (load_type) {
213 case LoadTypeURL: 223 case LoadTypeURL:
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 1844
1835 bool WebMediaPlayerAndroid::IsHLSStream() const { 1845 bool WebMediaPlayerAndroid::IsHLSStream() const {
1836 std::string mime; 1846 std::string mime;
1837 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; 1847 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_;
1838 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) 1848 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime))
1839 return false; 1849 return false;
1840 return !mime.compare("application/x-mpegurl"); 1850 return !mime.compare("application/x-mpegurl");
1841 } 1851 }
1842 1852
1843 } // namespace content 1853 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698