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

Side by Side Diff: media/base/video_frame.h

Issue 406893002: Fix DCHECKs in V4l2VideoDevice. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/media/v4l2_video_encode_accelerator.cc ('k') | media/base/video_frame.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 (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 #ifndef MEDIA_BASE_VIDEO_FRAME_H_ 5 #ifndef MEDIA_BASE_VIDEO_FRAME_H_
6 #define MEDIA_BASE_VIDEO_FRAME_H_ 6 #define MEDIA_BASE_VIDEO_FRAME_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 // Returns the required allocation size for a (tightly packed) plane of the 213 // Returns the required allocation size for a (tightly packed) plane of the
214 // given coded size and format. 214 // given coded size and format.
215 static size_t PlaneAllocationSize(Format format, 215 static size_t PlaneAllocationSize(Format format,
216 size_t plane, 216 size_t plane,
217 const gfx::Size& coded_size); 217 const gfx::Size& coded_size);
218 218
219 // Returns horizontal bits per pixel for given |plane| and |format|. 219 // Returns horizontal bits per pixel for given |plane| and |format|.
220 static int PlaneHorizontalBitsPerPixel(Format format, size_t plane); 220 static int PlaneHorizontalBitsPerPixel(Format format, size_t plane);
221 221
222 // Returns the number of bytes per row for the given plane, format, and width.
223 // The width may be aligned to format requirements.
224 static int RowBytes(size_t plane, Format format, int width);
225
222 Format format() const { return format_; } 226 Format format() const { return format_; }
223 227
224 const gfx::Size& coded_size() const { return coded_size_; } 228 const gfx::Size& coded_size() const { return coded_size_; }
225 const gfx::Rect& visible_rect() const { return visible_rect_; } 229 const gfx::Rect& visible_rect() const { return visible_rect_; }
226 const gfx::Size& natural_size() const { return natural_size_; } 230 const gfx::Size& natural_size() const { return natural_size_; }
227 231
228 int stride(size_t plane) const; 232 int stride(size_t plane) const;
229 233
230 // Returns the number of bytes per row and number of rows for a given plane. 234 // Returns the number of bytes per row and number of rows for a given plane.
231 // 235 //
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // VideoFrame. 281 // VideoFrame.
278 // This method is thread safe. Both blink and compositor threads can call it. 282 // This method is thread safe. Both blink and compositor threads can call it.
279 void UpdateReleaseSyncPoint(SyncPointClient* client); 283 void UpdateReleaseSyncPoint(SyncPointClient* client);
280 284
281 // Used to keep a running hash of seen frames. Expects an initialized MD5 285 // Used to keep a running hash of seen frames. Expects an initialized MD5
282 // context. Calls MD5Update with the context and the contents of the frame. 286 // context. Calls MD5Update with the context and the contents of the frame.
283 void HashFrameForTesting(base::MD5Context* context); 287 void HashFrameForTesting(base::MD5Context* context);
284 288
285 private: 289 private:
286 friend class base::RefCountedThreadSafe<VideoFrame>; 290 friend class base::RefCountedThreadSafe<VideoFrame>;
291
292 // Returns true if |plane| is a valid plane number for the given format. This
293 // can be used to DCHECK() plane parameters.
294 static bool IsValidPlane(size_t plane, VideoFrame::Format format);
295
287 // Clients must use the static CreateFrame() method to create a new frame. 296 // Clients must use the static CreateFrame() method to create a new frame.
288 VideoFrame(Format format, 297 VideoFrame(Format format,
289 const gfx::Size& coded_size, 298 const gfx::Size& coded_size,
290 const gfx::Rect& visible_rect, 299 const gfx::Rect& visible_rect,
291 const gfx::Size& natural_size, 300 const gfx::Size& natural_size,
292 scoped_ptr<gpu::MailboxHolder> mailbox_holder, 301 scoped_ptr<gpu::MailboxHolder> mailbox_holder,
293 base::TimeDelta timestamp, 302 base::TimeDelta timestamp,
294 bool end_of_stream); 303 bool end_of_stream);
295 virtual ~VideoFrame(); 304 virtual ~VideoFrame();
296 305
297 void AllocateYUV(); 306 void AllocateYUV();
298 307
299 // Used to DCHECK() plane parameters.
300 bool IsValidPlane(size_t plane) const;
301
302 // Frame format. 308 // Frame format.
303 const Format format_; 309 const Format format_;
304 310
305 // Width and height of the video frame, in pixels. This must include pixel 311 // Width and height of the video frame, in pixels. This must include pixel
306 // data for the whole image; i.e. for YUV formats with subsampled chroma 312 // data for the whole image; i.e. for YUV formats with subsampled chroma
307 // planes, in the case that the visible portion of the image does not line up 313 // planes, in the case that the visible portion of the image does not line up
308 // on a sample boundary, |coded_size_| must be rounded up appropriately and 314 // on a sample boundary, |coded_size_| must be rounded up appropriately and
309 // the pixel data provided for the odd pixels. 315 // the pixel data provided for the odd pixels.
310 const gfx::Size coded_size_; 316 const gfx::Size coded_size_;
311 317
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 uint32 release_sync_point_; 354 uint32 release_sync_point_;
349 355
350 const bool end_of_stream_; 356 const bool end_of_stream_;
351 357
352 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); 358 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame);
353 }; 359 };
354 360
355 } // namespace media 361 } // namespace media
356 362
357 #endif // MEDIA_BASE_VIDEO_FRAME_H_ 363 #endif // MEDIA_BASE_VIDEO_FRAME_H_
OLDNEW
« no previous file with comments | « content/common/gpu/media/v4l2_video_encode_accelerator.cc ('k') | media/base/video_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698