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 | |
125 SkImageInfo info = SkImageInfo::MakeN32Premul(desc.fWidth, desc.fHeight); | 120 SkImageInfo info = SkImageInfo::MakeN32Premul(desc.fWidth, desc.fHeight); |
126 SkGrPixelRef* pixel_ref = SkNEW_ARGS(SkGrPixelRef, (info, texture.get())); | 121 SkGrPixelRef* pixel_ref = SkNEW_ARGS(SkGrPixelRef, (info, texture.get())); |
127 if (!pixel_ref) | 122 if (!pixel_ref) |
128 return false; | 123 return false; |
129 bitmap->setInfo(info); | 124 bitmap->setInfo(info); |
130 bitmap->setPixelRef(pixel_ref)->unref(); | 125 bitmap->setPixelRef(pixel_ref)->unref(); |
131 return true; | 126 return true; |
132 } | 127 } |
133 | 128 |
134 class SyncPointClientImpl : public media::VideoFrame::SyncPointClient { | 129 class SyncPointClientImpl : public media::VideoFrame::SyncPointClient { |
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 | 1857 |
1863 bool WebMediaPlayerAndroid::IsHLSStream() const { | 1858 bool WebMediaPlayerAndroid::IsHLSStream() const { |
1864 std::string mime; | 1859 std::string mime; |
1865 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; | 1860 GURL url = redirected_url_.is_empty() ? url_ : redirected_url_; |
1866 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) | 1861 if (!net::GetMimeTypeFromFile(base::FilePath(url.path()), &mime)) |
1867 return false; | 1862 return false; |
1868 return !mime.compare("application/x-mpegurl"); | 1863 return !mime.compare("application/x-mpegurl"); |
1869 } | 1864 } |
1870 | 1865 |
1871 } // namespace content | 1866 } // namespace content |
OLD | NEW |