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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 return CreateForHardwarePlanes(video_frame); | 54 return CreateForHardwarePlanes(video_frame); |
55 else | 55 else |
56 return CreateForSoftwarePlanes(video_frame); | 56 return CreateForSoftwarePlanes(video_frame); |
57 } | 57 } |
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::YV12A: | 65 case media::VideoFrame::YV12A: |
65 case media::VideoFrame::YV16: | 66 case media::VideoFrame::YV16: |
66 case media::VideoFrame::YV12J: | 67 case media::VideoFrame::YV12J: |
67 case media::VideoFrame::NATIVE_TEXTURE: | 68 case media::VideoFrame::NATIVE_TEXTURE: |
68 #if defined(VIDEO_HOLE) | 69 #if defined(VIDEO_HOLE) |
69 case media::VideoFrame::HOLE: | 70 case media::VideoFrame::HOLE: |
70 #endif // defined(VIDEO_HOLE) | 71 #endif // defined(VIDEO_HOLE) |
71 return true; | 72 return true; |
72 | 73 |
73 // Unacceptable inputs. ¯\(°_o)/¯ | 74 // Unacceptable inputs. ¯\(°_o)/¯ |
74 case media::VideoFrame::UNKNOWN: | 75 case media::VideoFrame::UNKNOWN: |
75 case media::VideoFrame::I420: | |
76 break; | 76 break; |
77 } | 77 } |
78 return false; | 78 return false; |
79 } | 79 } |
80 | 80 |
81 // For frames that we receive in software format, determine the dimensions of | 81 // For frames that we receive in software format, determine the dimensions of |
82 // each plane in the frame. | 82 // each plane in the frame. |
83 static gfx::Size SoftwarePlaneDimension( | 83 static gfx::Size SoftwarePlaneDimension( |
84 const scoped_refptr<media::VideoFrame>& input_frame, | 84 const scoped_refptr<media::VideoFrame>& input_frame, |
85 ResourceFormat output_resource_format, | 85 ResourceFormat output_resource_format, |
(...skipping 14 matching lines...) Expand all Loading... |
100 #if defined(VIDEO_HOLE) | 100 #if defined(VIDEO_HOLE) |
101 if (input_frame_format == media::VideoFrame::HOLE) { | 101 if (input_frame_format == media::VideoFrame::HOLE) { |
102 VideoFrameExternalResources external_resources; | 102 VideoFrameExternalResources external_resources; |
103 external_resources.type = VideoFrameExternalResources::HOLE; | 103 external_resources.type = VideoFrameExternalResources::HOLE; |
104 return external_resources; | 104 return external_resources; |
105 } | 105 } |
106 #endif // defined(VIDEO_HOLE) | 106 #endif // defined(VIDEO_HOLE) |
107 | 107 |
108 // Only YUV software video frames are supported. | 108 // Only YUV software video frames are supported. |
109 DCHECK(input_frame_format == media::VideoFrame::YV12 || | 109 DCHECK(input_frame_format == media::VideoFrame::YV12 || |
| 110 input_frame_format == media::VideoFrame::I420 || |
110 input_frame_format == media::VideoFrame::YV12A || | 111 input_frame_format == media::VideoFrame::YV12A || |
111 input_frame_format == media::VideoFrame::YV12J || | 112 input_frame_format == media::VideoFrame::YV12J || |
112 input_frame_format == media::VideoFrame::YV16); | 113 input_frame_format == media::VideoFrame::YV16); |
113 if (input_frame_format != media::VideoFrame::YV12 && | 114 if (input_frame_format != media::VideoFrame::YV12 && |
| 115 input_frame_format != media::VideoFrame::I420 && |
114 input_frame_format != media::VideoFrame::YV12A && | 116 input_frame_format != media::VideoFrame::YV12A && |
115 input_frame_format != media::VideoFrame::YV12J && | 117 input_frame_format != media::VideoFrame::YV12J && |
116 input_frame_format != media::VideoFrame::YV16) | 118 input_frame_format != media::VideoFrame::YV16) |
117 return VideoFrameExternalResources(); | 119 return VideoFrameExternalResources(); |
118 | 120 |
119 bool software_compositor = context_provider_ == NULL; | 121 bool software_compositor = context_provider_ == NULL; |
120 | 122 |
121 ResourceFormat output_resource_format = kYUVResourceFormat; | 123 ResourceFormat output_resource_format = kYUVResourceFormat; |
122 size_t output_plane_count = media::VideoFrame::NumPlanes(input_frame_format); | 124 size_t output_plane_count = media::VideoFrame::NumPlanes(input_frame_format); |
123 | 125 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 } | 354 } |
353 | 355 |
354 PlaneResource recycled_resource(data.resource_id, | 356 PlaneResource recycled_resource(data.resource_id, |
355 data.resource_size, | 357 data.resource_size, |
356 data.resource_format, | 358 data.resource_format, |
357 data.mailbox); | 359 data.mailbox); |
358 updater->recycled_resources_.push_back(recycled_resource); | 360 updater->recycled_resources_.push_back(recycled_resource); |
359 } | 361 } |
360 | 362 |
361 } // namespace cc | 363 } // namespace cc |
OLD | NEW |