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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 desc.fSampleCnt = 0; | 110 desc.fSampleCnt = 0; |
111 desc.fOrigin = kTopLeft_GrSurfaceOrigin; | 111 desc.fOrigin = kTopLeft_GrSurfaceOrigin; |
112 desc.fWidth = size.width(); | 112 desc.fWidth = size.width(); |
113 desc.fHeight = size.height(); | 113 desc.fHeight = size.height(); |
114 skia::RefPtr<GrTexture> texture = skia::AdoptRef( | 114 skia::RefPtr<GrTexture> texture = skia::AdoptRef( |
115 gr->textureProvider()->refScratchTexture( | 115 gr->textureProvider()->refScratchTexture( |
116 desc, GrTextureProvider::kExact_ScratchTexMatch)); | 116 desc, GrTextureProvider::kExact_ScratchTexMatch)); |
117 if (!texture.get()) | 117 if (!texture.get()) |
118 return false; | 118 return false; |
119 | 119 |
| 120 // A recycled texture may have pending writes. Make sure they are flushed |
| 121 // before the texture is handed over for subsequent operations done outside |
| 122 // of Skia. |
| 123 texture->flushWrites(); |
| 124 |
120 SkImageInfo info = SkImageInfo::MakeN32Premul(desc.fWidth, desc.fHeight); | 125 SkImageInfo info = SkImageInfo::MakeN32Premul(desc.fWidth, desc.fHeight); |
121 SkGrPixelRef* pixel_ref = SkNEW_ARGS(SkGrPixelRef, (info, texture.get())); | 126 SkGrPixelRef* pixel_ref = SkNEW_ARGS(SkGrPixelRef, (info, texture.get())); |
122 if (!pixel_ref) | 127 if (!pixel_ref) |
123 return false; | 128 return false; |
124 bitmap->setInfo(info); | 129 bitmap->setInfo(info); |
125 bitmap->setPixelRef(pixel_ref)->unref(); | 130 bitmap->setPixelRef(pixel_ref)->unref(); |
126 return true; | 131 return true; |
127 } | 132 } |
128 | 133 |
129 class SyncPointClientImpl : public media::VideoFrame::SyncPointClient { | 134 class SyncPointClientImpl : public media::VideoFrame::SyncPointClient { |
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1857 | 1862 |
1858 bool WebMediaPlayerAndroid::IsHLSStream() const { | 1863 bool WebMediaPlayerAndroid::IsHLSStream() const { |
1859 std::string mime; | 1864 std::string mime; |
1860 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; | 1865 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; |
1861 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) | 1866 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) |
1862 return false; | 1867 return false; |
1863 return !mime.compare("application/x-mpegurl"); | 1868 return !mime.compare("application/x-mpegurl"); |
1864 } | 1869 } |
1865 | 1870 |
1866 } // namespace content | 1871 } // namespace content |
OLD | NEW |