| 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 "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "cc/output/gl_renderer.h" | 9 #include "cc/output/gl_renderer.h" |
| 10 #include "cc/resources/resource_provider.h" | 10 #include "cc/resources/resource_provider.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 bool VideoResourceUpdater::VerifyFrame( | 79 bool VideoResourceUpdater::VerifyFrame( |
| 80 const scoped_refptr<media::VideoFrame>& video_frame) { | 80 const scoped_refptr<media::VideoFrame>& video_frame) { |
| 81 switch (video_frame->format()) { | 81 switch (video_frame->format()) { |
| 82 // Acceptable inputs. | 82 // Acceptable inputs. |
| 83 case media::VideoFrame::YV12: | 83 case media::VideoFrame::YV12: |
| 84 case media::VideoFrame::I420: | 84 case media::VideoFrame::I420: |
| 85 case media::VideoFrame::YV12A: | 85 case media::VideoFrame::YV12A: |
| 86 case media::VideoFrame::YV16: | 86 case media::VideoFrame::YV16: |
| 87 case media::VideoFrame::YV12J: | 87 case media::VideoFrame::YV12J: |
| 88 case media::VideoFrame::YV12HD: |
| 88 case media::VideoFrame::YV24: | 89 case media::VideoFrame::YV24: |
| 89 case media::VideoFrame::NATIVE_TEXTURE: | 90 case media::VideoFrame::NATIVE_TEXTURE: |
| 90 #if defined(VIDEO_HOLE) | 91 #if defined(VIDEO_HOLE) |
| 91 case media::VideoFrame::HOLE: | 92 case media::VideoFrame::HOLE: |
| 92 #endif // defined(VIDEO_HOLE) | 93 #endif // defined(VIDEO_HOLE) |
| 93 return true; | 94 return true; |
| 94 | 95 |
| 95 // Unacceptable inputs. ¯\(°_o)/¯ | 96 // Unacceptable inputs. ¯\(°_o)/¯ |
| 96 case media::VideoFrame::UNKNOWN: | 97 case media::VideoFrame::UNKNOWN: |
| 97 case media::VideoFrame::NV12: | 98 case media::VideoFrame::NV12: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 126 external_resources.type = VideoFrameExternalResources::HOLE; | 127 external_resources.type = VideoFrameExternalResources::HOLE; |
| 127 return external_resources; | 128 return external_resources; |
| 128 } | 129 } |
| 129 #endif // defined(VIDEO_HOLE) | 130 #endif // defined(VIDEO_HOLE) |
| 130 | 131 |
| 131 // Only YUV software video frames are supported. | 132 // Only YUV software video frames are supported. |
| 132 DCHECK(input_frame_format == media::VideoFrame::YV12 || | 133 DCHECK(input_frame_format == media::VideoFrame::YV12 || |
| 133 input_frame_format == media::VideoFrame::I420 || | 134 input_frame_format == media::VideoFrame::I420 || |
| 134 input_frame_format == media::VideoFrame::YV12A || | 135 input_frame_format == media::VideoFrame::YV12A || |
| 135 input_frame_format == media::VideoFrame::YV12J || | 136 input_frame_format == media::VideoFrame::YV12J || |
| 137 input_frame_format == media::VideoFrame::YV12HD || |
| 136 input_frame_format == media::VideoFrame::YV16 || | 138 input_frame_format == media::VideoFrame::YV16 || |
| 137 input_frame_format == media::VideoFrame::YV24); | 139 input_frame_format == media::VideoFrame::YV24); |
| 138 if (input_frame_format != media::VideoFrame::YV12 && | 140 if (input_frame_format != media::VideoFrame::YV12 && |
| 139 input_frame_format != media::VideoFrame::I420 && | 141 input_frame_format != media::VideoFrame::I420 && |
| 140 input_frame_format != media::VideoFrame::YV12A && | 142 input_frame_format != media::VideoFrame::YV12A && |
| 141 input_frame_format != media::VideoFrame::YV12J && | 143 input_frame_format != media::VideoFrame::YV12J && |
| 144 input_frame_format != media::VideoFrame::YV12HD && |
| 142 input_frame_format != media::VideoFrame::YV16 && | 145 input_frame_format != media::VideoFrame::YV16 && |
| 143 input_frame_format != media::VideoFrame::YV24) | 146 input_frame_format != media::VideoFrame::YV24) |
| 144 return VideoFrameExternalResources(); | 147 return VideoFrameExternalResources(); |
| 145 | 148 |
| 146 bool software_compositor = context_provider_ == NULL; | 149 bool software_compositor = context_provider_ == NULL; |
| 147 | 150 |
| 148 ResourceFormat output_resource_format = kYUVResourceFormat; | 151 ResourceFormat output_resource_format = kYUVResourceFormat; |
| 149 size_t output_plane_count = media::VideoFrame::NumPlanes(input_frame_format); | 152 size_t output_plane_count = media::VideoFrame::NumPlanes(input_frame_format); |
| 150 | 153 |
| 151 // TODO(skaslev): If we're in software compositing mode, we do the YUV -> RGB | 154 // TODO(skaslev): If we're in software compositing mode, we do the YUV -> RGB |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 } | 393 } |
| 391 | 394 |
| 392 PlaneResource recycled_resource(data.resource_id, | 395 PlaneResource recycled_resource(data.resource_id, |
| 393 data.resource_size, | 396 data.resource_size, |
| 394 data.resource_format, | 397 data.resource_format, |
| 395 data.mailbox); | 398 data.mailbox); |
| 396 updater->recycled_resources_.push_back(recycled_resource); | 399 updater->recycled_resources_.push_back(recycled_resource); |
| 397 } | 400 } |
| 398 | 401 |
| 399 } // namespace cc | 402 } // namespace cc |
| OLD | NEW |