OLD | NEW |
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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 { | 204 { |
205 base::AutoLock auto_lock(current_frame_lock_); | 205 base::AutoLock auto_lock(current_frame_lock_); |
206 current_frame_ = NULL; | 206 current_frame_ = NULL; |
207 } | 207 } |
208 | 208 |
209 if (delegate_) | 209 if (delegate_) |
210 delegate_->PlayerGone(this); | 210 delegate_->PlayerGone(this); |
211 | 211 |
212 stream_texture_factory_->RemoveObserver(this); | 212 stream_texture_factory_->RemoveObserver(this); |
| 213 |
| 214 if (media_source_delegate_) { |
| 215 // Part of |media_source_delegate_| needs to be stopped on the media thread. |
| 216 // Wait until |media_source_delegate_| is fully stopped before tearing |
| 217 // down other objects. |
| 218 base::WaitableEvent waiter(false, false); |
| 219 media_source_delegate_->Stop( |
| 220 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&waiter))); |
| 221 waiter.Wait(); |
| 222 } |
213 } | 223 } |
214 | 224 |
215 void WebMediaPlayerAndroid::load(LoadType load_type, | 225 void WebMediaPlayerAndroid::load(LoadType load_type, |
216 const blink::WebURL& url, | 226 const blink::WebURL& url, |
217 CORSMode cors_mode) { | 227 CORSMode cors_mode) { |
218 DCHECK(main_thread_checker_.CalledOnValidThread()); | 228 DCHECK(main_thread_checker_.CalledOnValidThread()); |
219 media::ReportMediaSchemeUma(GURL(url)); | 229 media::ReportMediaSchemeUma(GURL(url)); |
220 | 230 |
221 switch (load_type) { | 231 switch (load_type) { |
222 case LoadTypeURL: | 232 case LoadTypeURL: |
(...skipping 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1814 | 1824 |
1815 bool WebMediaPlayerAndroid::IsHLSStream() const { | 1825 bool WebMediaPlayerAndroid::IsHLSStream() const { |
1816 std::string mime; | 1826 std::string mime; |
1817 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; | 1827 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; |
1818 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) | 1828 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) |
1819 return false; | 1829 return false; |
1820 return !mime.compare("application/x-mpegurl"); | 1830 return !mime.compare("application/x-mpegurl"); |
1821 } | 1831 } |
1822 | 1832 |
1823 } // namespace content | 1833 } // namespace content |
OLD | NEW |