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

Side by Side Diff: media/blink/video_frame_compositor.cc

Issue 1154153003: Relanding 1143663007: VideoFrame: Separate Pixel Format from Storage Type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added NV12 support in CrOS Created 5 years, 6 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/skcanvas_video_renderer.cc ('k') | media/blink/webmediaplayer_impl.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/blink/video_frame_compositor.h" 5 #include "media/blink/video_frame_compositor.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/time/default_tick_clock.h" 9 #include "base/time/default_tick_clock.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
11 #include "media/base/video_frame.h" 11 #include "media/base/video_frame.h"
12 12
13 namespace media { 13 namespace media {
14 14
15 // Amount of time to wait between UpdateCurrentFrame() callbacks before starting 15 // Amount of time to wait between UpdateCurrentFrame() callbacks before starting
16 // background rendering to keep the Render() callbacks moving. 16 // background rendering to keep the Render() callbacks moving.
17 const int kBackgroundRenderingTimeoutMs = 250; 17 const int kBackgroundRenderingTimeoutMs = 250;
18 18
19 // Returns true if the format has no Alpha channel (hence is always opaque).
19 static bool IsOpaque(const scoped_refptr<VideoFrame>& frame) { 20 static bool IsOpaque(const scoped_refptr<VideoFrame>& frame) {
20 switch (frame->format()) { 21 switch (frame->format()) {
21 case VideoFrame::UNKNOWN: 22 case VideoFrame::UNKNOWN:
22 case VideoFrame::YV12: 23 case VideoFrame::YV12:
24 case VideoFrame::I420:
23 case VideoFrame::YV16: 25 case VideoFrame::YV16:
24 case VideoFrame::I420:
25 case VideoFrame::YV24: 26 case VideoFrame::YV24:
27 #if defined(OS_MACOSX) || defined(OS_CHROMEOS)
26 case VideoFrame::NV12: 28 case VideoFrame::NV12:
29 #endif
30 case VideoFrame::XRGB:
27 return true; 31 return true;
28
29 case VideoFrame::YV12A: 32 case VideoFrame::YV12A:
30 #if defined(VIDEO_HOLE)
31 case VideoFrame::HOLE:
32 #endif // defined(VIDEO_HOLE)
33 case VideoFrame::NATIVE_TEXTURE:
34 case VideoFrame::ARGB: 33 case VideoFrame::ARGB:
35 break; 34 break;
36 } 35 }
37 return false; 36 return false;
38 } 37 }
39 38
40 VideoFrameCompositor::VideoFrameCompositor( 39 VideoFrameCompositor::VideoFrameCompositor(
41 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner, 40 const scoped_refptr<base::SingleThreadTaskRunner>& compositor_task_runner,
42 const base::Callback<void(gfx::Size)>& natural_size_changed_cb, 41 const base::Callback<void(gfx::Size)>& natural_size_changed_cb,
43 const base::Callback<void(bool)>& opacity_changed_cb) 42 const base::Callback<void(bool)>& opacity_changed_cb)
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 last_interval_ = deadline_max - deadline_min; 249 last_interval_ = deadline_max - deadline_min;
251 250
252 // Restart the background rendering timer whether we're background rendering 251 // Restart the background rendering timer whether we're background rendering
253 // or not; in either case we should wait for |kBackgroundRenderingTimeoutMs|. 252 // or not; in either case we should wait for |kBackgroundRenderingTimeoutMs|.
254 if (background_rendering_enabled_) 253 if (background_rendering_enabled_)
255 background_rendering_timer_.Reset(); 254 background_rendering_timer_.Reset();
256 return new_frame; 255 return new_frame;
257 } 256 }
258 257
259 } // namespace media 258 } // namespace media
OLDNEW
« no previous file with comments | « media/blink/skcanvas_video_renderer.cc ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698