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 "cc/resources/video_resource_updater.h" | 5 #include "cc/resources/video_resource_updater.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "cc/output/gl_renderer.h" | 8 #include "cc/output/gl_renderer.h" |
9 #include "cc/resources/resource_provider.h" | 9 #include "cc/resources/resource_provider.h" |
10 #include "gpu/GLES2/gl2extchromium.h" | 10 #include "gpu/GLES2/gl2extchromium.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 bool VideoResourceUpdater::VerifyFrame( | 59 bool VideoResourceUpdater::VerifyFrame( |
60 const scoped_refptr<media::VideoFrame>& video_frame) { | 60 const scoped_refptr<media::VideoFrame>& video_frame) { |
61 switch (video_frame->format()) { | 61 switch (video_frame->format()) { |
62 // Acceptable inputs. | 62 // Acceptable inputs. |
63 case media::VideoFrame::YV12: | 63 case media::VideoFrame::YV12: |
64 case media::VideoFrame::I420: | 64 case media::VideoFrame::I420: |
65 case media::VideoFrame::YV12A: | 65 case media::VideoFrame::YV12A: |
66 case media::VideoFrame::YV16: | 66 case media::VideoFrame::YV16: |
67 case media::VideoFrame::YV12J: | 67 case media::VideoFrame::YV12J: |
| 68 case media::VideoFrame::YV24: |
68 case media::VideoFrame::NATIVE_TEXTURE: | 69 case media::VideoFrame::NATIVE_TEXTURE: |
69 #if defined(VIDEO_HOLE) | 70 #if defined(VIDEO_HOLE) |
70 case media::VideoFrame::HOLE: | 71 case media::VideoFrame::HOLE: |
71 #endif // defined(VIDEO_HOLE) | 72 #endif // defined(VIDEO_HOLE) |
72 return true; | 73 return true; |
73 | 74 |
74 // Unacceptable inputs. ¯\(°_o)/¯ | 75 // Unacceptable inputs. ¯\(°_o)/¯ |
75 case media::VideoFrame::UNKNOWN: | 76 case media::VideoFrame::UNKNOWN: |
76 case media::VideoFrame::NV12: | 77 case media::VideoFrame::NV12: |
77 break; | 78 break; |
(...skipping 26 matching lines...) Expand all Loading... |
104 external_resources.type = VideoFrameExternalResources::HOLE; | 105 external_resources.type = VideoFrameExternalResources::HOLE; |
105 return external_resources; | 106 return external_resources; |
106 } | 107 } |
107 #endif // defined(VIDEO_HOLE) | 108 #endif // defined(VIDEO_HOLE) |
108 | 109 |
109 // Only YUV software video frames are supported. | 110 // Only YUV software video frames are supported. |
110 DCHECK(input_frame_format == media::VideoFrame::YV12 || | 111 DCHECK(input_frame_format == media::VideoFrame::YV12 || |
111 input_frame_format == media::VideoFrame::I420 || | 112 input_frame_format == media::VideoFrame::I420 || |
112 input_frame_format == media::VideoFrame::YV12A || | 113 input_frame_format == media::VideoFrame::YV12A || |
113 input_frame_format == media::VideoFrame::YV12J || | 114 input_frame_format == media::VideoFrame::YV12J || |
114 input_frame_format == media::VideoFrame::YV16); | 115 input_frame_format == media::VideoFrame::YV16 || |
| 116 input_frame_format == media::VideoFrame::YV24); |
115 if (input_frame_format != media::VideoFrame::YV12 && | 117 if (input_frame_format != media::VideoFrame::YV12 && |
116 input_frame_format != media::VideoFrame::I420 && | 118 input_frame_format != media::VideoFrame::I420 && |
117 input_frame_format != media::VideoFrame::YV12A && | 119 input_frame_format != media::VideoFrame::YV12A && |
118 input_frame_format != media::VideoFrame::YV12J && | 120 input_frame_format != media::VideoFrame::YV12J && |
119 input_frame_format != media::VideoFrame::YV16) | 121 input_frame_format != media::VideoFrame::YV16 && |
| 122 input_frame_format != media::VideoFrame::YV24) |
120 return VideoFrameExternalResources(); | 123 return VideoFrameExternalResources(); |
121 | 124 |
122 bool software_compositor = context_provider_ == NULL; | 125 bool software_compositor = context_provider_ == NULL; |
123 | 126 |
124 ResourceFormat output_resource_format = kYUVResourceFormat; | 127 ResourceFormat output_resource_format = kYUVResourceFormat; |
125 size_t output_plane_count = media::VideoFrame::NumPlanes(input_frame_format); | 128 size_t output_plane_count = media::VideoFrame::NumPlanes(input_frame_format); |
126 | 129 |
127 // TODO(skaslev): If we're in software compositing mode, we do the YUV -> RGB | 130 // TODO(skaslev): If we're in software compositing mode, we do the YUV -> RGB |
128 // conversion here. That involves an extra copy of each frame to a bitmap. | 131 // conversion here. That involves an extra copy of each frame to a bitmap. |
129 // Obviously, this is suboptimal and should be addressed once ubercompositor | 132 // Obviously, this is suboptimal and should be addressed once ubercompositor |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 } | 358 } |
356 | 359 |
357 PlaneResource recycled_resource(data.resource_id, | 360 PlaneResource recycled_resource(data.resource_id, |
358 data.resource_size, | 361 data.resource_size, |
359 data.resource_format, | 362 data.resource_format, |
360 data.mailbox); | 363 data.mailbox); |
361 updater->recycled_resources_.push_back(recycled_resource); | 364 updater->recycled_resources_.push_back(recycled_resource); |
362 } | 365 } |
363 | 366 |
364 } // namespace cc | 367 } // namespace cc |
OLD | NEW |