summaryrefslogtreecommitdiffstats
path: root/media/base/video_frame.h
diff options
context:
space:
mode:
authormcasas <mcasas@chromium.org>2015-06-23 11:09:03 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-23 18:10:02 +0000
commit5c799a3909484c32211ccb35a3efd870fce5e7ac (patch)
tree09c5a3d82971fbe10fa6f8216760c41c51e871aa /media/base/video_frame.h
parent1d3fe7320229d48fbf604535c8a435c03df022c4 (diff)
downloadchromium_src-5c799a3909484c32211ccb35a3efd870fce5e7ac.zip
chromium_src-5c799a3909484c32211ccb35a3efd870fce5e7ac.tar.gz
chromium_src-5c799a3909484c32211ccb35a3efd870fce5e7ac.tar.bz2
VideoFrame method reordering and minor cleanup
This CL cleans up a few itches I found during previous CLs: - Reorders VideoFrame methods to follow declaration/style guide. - Removes VideoFrame::PlaneAllocationSize() and replaced its use with VideoFrame::PlaneSize().GetArea() since clients absolutely know what they are doing and this convenience method is thus more a burden - Turns HashFrameForTesting() into static. - Removes ReleaseData() and binds base::AlignedFree() directly. BUG=489744 Review URL: https://codereview.chromium.org/1195153003 Cr-Commit-Position: refs/heads/master@{#335701}
Diffstat (limited to 'media/base/video_frame.h')
-rw-r--r--media/base/video_frame.h68
1 files changed, 33 insertions, 35 deletions
diff --git a/media/base/video_frame.h b/media/base/video_frame.h
index 26dac09..2588e46 100644
--- a/media/base/video_frame.h
+++ b/media/base/video_frame.h
@@ -108,6 +108,20 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// destroyed.
typedef base::Callback<void(uint32)> ReleaseMailboxCB;
+ // Interface representing client operations on a SyncPoint, i.e. insert one in
+ // the GPU Command Buffer and wait for it.
+ class SyncPointClient {
+ public:
+ SyncPointClient() {}
+ virtual uint32 InsertSyncPoint() = 0;
+ virtual void WaitSyncPoint(uint32 sync_point) = 0;
+
+ protected:
+ virtual ~SyncPointClient() {}
+
+ DISALLOW_COPY_AND_ASSIGN(SyncPointClient);
+ };
+
// Returns the name of a Format as a string.
static std::string FormatToString(Format format);
@@ -272,18 +286,12 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// given coded size and format.
static size_t AllocationSize(Format format, const gfx::Size& coded_size);
- // Returns the plane size (in bytes) for a plane of the given coded size and
- // format.
+ // Returns the plane gfx::Size (in bytes) for a plane of the given coded size
+ // and format.
static gfx::Size PlaneSize(Format format,
size_t plane,
const gfx::Size& coded_size);
- // Returns the required allocation size for a (tightly packed) plane of the
- // given coded size and format.
- static size_t PlaneAllocationSize(Format format,
- size_t plane,
- const gfx::Size& coded_size);
-
// Returns horizontal bits per pixel for given |plane| and |format|.
static int PlaneHorizontalBitsPerPixel(Format format, size_t plane);
@@ -302,6 +310,11 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// The width may be aligned to format requirements.
static size_t Columns(size_t plane, Format format, int width);
+ // Used to keep a running hash of seen frames. Expects an initialized MD5
+ // context. Calls MD5Update with the context and the contents of the frame.
+ static void HashFrameForTesting(base::MD5Context* context,
+ const scoped_refptr<VideoFrame>& frame);
+
// Returns true if |frame| is accessible and mapped in the VideoFrame memory
// space. If false, clients should refrain from accessing data(),
// visible_data() etc.
@@ -392,30 +405,27 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
timestamp_ = timestamp;
}
- class SyncPointClient {
- public:
- SyncPointClient() {}
- virtual uint32 InsertSyncPoint() = 0;
- virtual void WaitSyncPoint(uint32 sync_point) = 0;
-
- protected:
- virtual ~SyncPointClient() {}
-
- DISALLOW_COPY_AND_ASSIGN(SyncPointClient);
- };
// It uses |client| to insert a new sync point and potentially waits on a
// older sync point. The final sync point will be used to release this
// VideoFrame.
// This method is thread safe. Both blink and compositor threads can call it.
void UpdateReleaseSyncPoint(SyncPointClient* client);
- // Used to keep a running hash of seen frames. Expects an initialized MD5
- // context. Calls MD5Update with the context and the contents of the frame.
- void HashFrameForTesting(base::MD5Context* context);
-
private:
friend class base::RefCountedThreadSafe<VideoFrame>;
+ static scoped_refptr<VideoFrame> WrapExternalStorage(
+ Format format,
+ StorageType storage_type,
+ const gfx::Size& coded_size,
+ const gfx::Rect& visible_rect,
+ const gfx::Size& natural_size,
+ uint8* data,
+ size_t data_size,
+ base::TimeDelta timestamp,
+ base::SharedMemoryHandle handle,
+ size_t data_offset);
+
// Clients must use the static factory/wrapping methods to create a new frame.
VideoFrame(Format format,
StorageType storage_type,
@@ -441,18 +451,6 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
base::TimeDelta timestamp);
virtual ~VideoFrame();
- static scoped_refptr<VideoFrame> WrapExternalStorage(
- Format format,
- StorageType storage_type,
- const gfx::Size& coded_size,
- const gfx::Rect& visible_rect,
- const gfx::Size& natural_size,
- uint8* data,
- size_t data_size,
- base::TimeDelta timestamp,
- base::SharedMemoryHandle handle,
- size_t data_offset);
-
void AllocateYUV();
// Frame format.