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

Side by Side Diff: media/filters/skcanvas_video_renderer.cc

Issue 809883004: Revert hardware decoder changes causing ChromeOS HW test crash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « media/blink/video_frame_compositor.cc ('k') | media/mojo/interfaces/media_types.mojom » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/filters/skcanvas_video_renderer.h" 5 #include "media/filters/skcanvas_video_renderer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/base/video_frame.h" 8 #include "media/base/video_frame.h"
9 #include "media/base/yuv_convert.h" 9 #include "media/base/yuv_convert.h"
10 #include "third_party/libyuv/include/libyuv.h" 10 #include "third_party/libyuv/include/libyuv.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 case VideoFrame::YV12A: 45 case VideoFrame::YV12A:
46 case VideoFrame::YV12J: 46 case VideoFrame::YV12J:
47 case VideoFrame::YV24: 47 case VideoFrame::YV24:
48 case VideoFrame::NV12: 48 case VideoFrame::NV12:
49 return true; 49 return true;
50 case VideoFrame::UNKNOWN: 50 case VideoFrame::UNKNOWN:
51 case VideoFrame::NATIVE_TEXTURE: 51 case VideoFrame::NATIVE_TEXTURE:
52 #if defined(VIDEO_HOLE) 52 #if defined(VIDEO_HOLE)
53 case VideoFrame::HOLE: 53 case VideoFrame::HOLE:
54 #endif // defined(VIDEO_HOLE) 54 #endif // defined(VIDEO_HOLE)
55 case VideoFrame::ARGB:
56 return false; 55 return false;
57 } 56 }
58 NOTREACHED() << "Invalid videoframe format provided: " << format; 57 NOTREACHED() << "Invalid videoframe format provided: " << format;
59 return false; 58 return false;
60 } 59 }
61 60
62 bool IsJPEGColorSpace(media::VideoFrame::Format format) { 61 bool IsJPEGColorSpace(media::VideoFrame::Format format) {
63 switch (format) { 62 switch (format) {
64 case VideoFrame::YV12J: 63 case VideoFrame::YV12J:
65 return true; 64 return true;
66 case VideoFrame::YV12: 65 case VideoFrame::YV12:
67 case VideoFrame::YV16: 66 case VideoFrame::YV16:
68 case VideoFrame::I420: 67 case VideoFrame::I420:
69 case VideoFrame::YV12A: 68 case VideoFrame::YV12A:
70 case VideoFrame::YV24: 69 case VideoFrame::YV24:
71 case VideoFrame::NV12: 70 case VideoFrame::NV12:
72 case VideoFrame::UNKNOWN: 71 case VideoFrame::UNKNOWN:
73 case VideoFrame::NATIVE_TEXTURE: 72 case VideoFrame::NATIVE_TEXTURE:
74 #if defined(VIDEO_HOLE) 73 #if defined(VIDEO_HOLE)
75 case VideoFrame::HOLE: 74 case VideoFrame::HOLE:
76 #endif // defined(VIDEO_HOLE) 75 #endif // defined(VIDEO_HOLE)
77 case VideoFrame::ARGB:
78 return false; 76 return false;
79 } 77 }
80 NOTREACHED() << "Invalid videoframe format provided: " << format; 78 NOTREACHED() << "Invalid videoframe format provided: " << format;
81 return false; 79 return false;
82 } 80 }
83 81
84 bool IsYUVOrNative(media::VideoFrame::Format format) { 82 bool IsYUVOrNative(media::VideoFrame::Format format) {
85 return IsYUV(format) || format == media::VideoFrame::NATIVE_TEXTURE; 83 return IsYUV(format) || format == media::VideoFrame::NATIVE_TEXTURE;
86 } 84 }
87 85
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 libyuv::ARGBToABGR(static_cast<uint8*>(rgb_pixels), 191 libyuv::ARGBToABGR(static_cast<uint8*>(rgb_pixels),
194 row_bytes, 192 row_bytes,
195 static_cast<uint8*>(rgb_pixels), 193 static_cast<uint8*>(rgb_pixels),
196 row_bytes, 194 row_bytes,
197 video_frame->visible_rect().width(), 195 video_frame->visible_rect().width(),
198 video_frame->visible_rect().height()); 196 video_frame->visible_rect().height());
199 #endif 197 #endif
200 break; 198 break;
201 199
202 case media::VideoFrame::NATIVE_TEXTURE: { 200 case media::VideoFrame::NATIVE_TEXTURE: {
201 DCHECK_EQ(video_frame->format(), media::VideoFrame::NATIVE_TEXTURE);
203 SkBitmap tmp; 202 SkBitmap tmp;
204 tmp.installPixels( 203 tmp.installPixels(
205 SkImageInfo::MakeN32Premul(video_frame->visible_rect().width(), 204 SkImageInfo::MakeN32Premul(video_frame->visible_rect().width(),
206 video_frame->visible_rect().height()), 205 video_frame->visible_rect().height()),
207 rgb_pixels, 206 rgb_pixels,
208 row_bytes); 207 row_bytes);
209 video_frame->ReadPixelsFromNativeTexture(tmp); 208 video_frame->ReadPixelsFromNativeTexture(tmp);
210 break; 209 break;
211 } 210 }
212
213 case media::VideoFrame::ARGB:
214 default: 211 default:
215 NOTREACHED(); 212 NOTREACHED();
216 break; 213 break;
217 } 214 }
218 } 215 }
219 216
220 } // anonymous namespace 217 } // anonymous namespace
221 218
222 // Generates an RGB image from a VideoFrame. Convert YUV to RGB plain on GPU. 219 // Generates an RGB image from a VideoFrame. Convert YUV to RGB plain on GPU.
223 class VideoImageGenerator : public SkImageGenerator { 220 class VideoImageGenerator : public SkImageGenerator {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 last_frame_timestamp_ = media::kNoTimestamp(); 453 last_frame_timestamp_ = media::kNoTimestamp();
457 } 454 }
458 455
459 void SkCanvasVideoRenderer::ResetAcceleratedLastFrame() { 456 void SkCanvasVideoRenderer::ResetAcceleratedLastFrame() {
460 accelerated_last_frame_.reset(); 457 accelerated_last_frame_.reset();
461 accelerated_generator_ = nullptr; 458 accelerated_generator_ = nullptr;
462 accelerated_last_frame_timestamp_ = media::kNoTimestamp(); 459 accelerated_last_frame_timestamp_ = media::kNoTimestamp();
463 } 460 }
464 461
465 } // namespace media 462 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/video_frame_compositor.cc ('k') | media/mojo/interfaces/media_types.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698