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

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

Issue 175223003: HW Video: Make media::VideoFrame handle the sync point of the compositor as well as webgl (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Add WaitSyncPoint in WMPImpl::paint(...) Created 6 years, 9 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
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 "base/callback.h" 8 #include "base/callback.h"
9 #include "base/md5.h" 9 #include "base/md5.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
11 #include "base/synchronization/lock.h"
11 #include "media/base/buffers.h" 12 #include "media/base/buffers.h"
12 #include "ui/gfx/rect.h" 13 #include "ui/gfx/rect.h"
13 #include "ui/gfx/size.h" 14 #include "ui/gfx/size.h"
14 15
15 class SkBitmap; 16 class SkBitmap;
16 17
17 namespace gpu { 18 namespace gpu {
18 struct MailboxHolder; 19 struct MailboxHolder;
19 } // namespace gpu 20 } // namespace gpu
20 21
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // Returns true if this VideoFrame represents the end of the stream. 216 // Returns true if this VideoFrame represents the end of the stream.
216 bool end_of_stream() const { return end_of_stream_; } 217 bool end_of_stream() const { return end_of_stream_; }
217 218
218 base::TimeDelta GetTimestamp() const { 219 base::TimeDelta GetTimestamp() const {
219 return timestamp_; 220 return timestamp_;
220 } 221 }
221 void SetTimestamp(const base::TimeDelta& timestamp) { 222 void SetTimestamp(const base::TimeDelta& timestamp) {
222 timestamp_ = timestamp; 223 timestamp_ = timestamp;
223 } 224 }
224 225
226 // Set |release_sync_point_| which will be set to the mailbox holder
227 // when |mailbox_holder_release_cb_| is called so that the gpu video decoder
228 // waits for the sync point before reusing the mailbox.
229 // This method is thread safe. Both blink and compositor threads can call it.
230 // Multiple clients can set multiple sync points in one frame. It returns
231 // the previous sync point that other client set. The caller has
232 // responsibility for wait for the previous sync point of another client.
233 uint32 SwapReleaseSyncPoint(uint32 sync_point);
234
225 // Used to keep a running hash of seen frames. Expects an initialized MD5 235 // Used to keep a running hash of seen frames. Expects an initialized MD5
226 // context. Calls MD5Update with the context and the contents of the frame. 236 // context. Calls MD5Update with the context and the contents of the frame.
227 void HashFrameForTesting(base::MD5Context* context); 237 void HashFrameForTesting(base::MD5Context* context);
228 238
229 private: 239 private:
230 friend class base::RefCountedThreadSafe<VideoFrame>; 240 friend class base::RefCountedThreadSafe<VideoFrame>;
231 // Clients must use the static CreateFrame() method to create a new frame. 241 // Clients must use the static CreateFrame() method to create a new frame.
232 VideoFrame(Format format, 242 VideoFrame(Format format,
233 const gfx::Size& coded_size, 243 const gfx::Size& coded_size,
234 const gfx::Rect& visible_rect, 244 const gfx::Rect& visible_rect,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 ReleaseMailboxCB mailbox_holder_release_cb_; 278 ReleaseMailboxCB mailbox_holder_release_cb_;
269 ReadPixelsCB read_pixels_cb_; 279 ReadPixelsCB read_pixels_cb_;
270 280
271 // Shared memory handle, if this frame was allocated from shared memory. 281 // Shared memory handle, if this frame was allocated from shared memory.
272 base::SharedMemoryHandle shared_memory_handle_; 282 base::SharedMemoryHandle shared_memory_handle_;
273 283
274 base::Closure no_longer_needed_cb_; 284 base::Closure no_longer_needed_cb_;
275 285
276 base::TimeDelta timestamp_; 286 base::TimeDelta timestamp_;
277 287
288 base::Lock release_sync_point_lock_;
289 uint32 release_sync_point_;
290
278 const bool end_of_stream_; 291 const bool end_of_stream_;
279 292
280 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); 293 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame);
281 }; 294 };
282 295
283 } // namespace media 296 } // namespace media
284 297
285 #endif // MEDIA_BASE_VIDEO_FRAME_H_ 298 #endif // MEDIA_BASE_VIDEO_FRAME_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698