OLD | NEW |
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 Loading... |
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 sync point before reusing the mailbox. |
| 229 // This method is thread safe. Both blink and compositor threads can call it. |
| 230 void SetReleaseSyncPoint(uint32 sync_point); |
| 231 |
225 // Used to keep a running hash of seen frames. Expects an initialized MD5 | 232 // 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. | 233 // context. Calls MD5Update with the context and the contents of the frame. |
227 void HashFrameForTesting(base::MD5Context* context); | 234 void HashFrameForTesting(base::MD5Context* context); |
228 | 235 |
229 private: | 236 private: |
230 friend class base::RefCountedThreadSafe<VideoFrame>; | 237 friend class base::RefCountedThreadSafe<VideoFrame>; |
231 // Clients must use the static CreateFrame() method to create a new frame. | 238 // Clients must use the static CreateFrame() method to create a new frame. |
232 VideoFrame(Format format, | 239 VideoFrame(Format format, |
233 const gfx::Size& coded_size, | 240 const gfx::Size& coded_size, |
234 const gfx::Rect& visible_rect, | 241 const gfx::Rect& visible_rect, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 ReleaseMailboxCB mailbox_holder_release_cb_; | 275 ReleaseMailboxCB mailbox_holder_release_cb_; |
269 ReadPixelsCB read_pixels_cb_; | 276 ReadPixelsCB read_pixels_cb_; |
270 | 277 |
271 // Shared memory handle, if this frame was allocated from shared memory. | 278 // Shared memory handle, if this frame was allocated from shared memory. |
272 base::SharedMemoryHandle shared_memory_handle_; | 279 base::SharedMemoryHandle shared_memory_handle_; |
273 | 280 |
274 base::Closure no_longer_needed_cb_; | 281 base::Closure no_longer_needed_cb_; |
275 | 282 |
276 base::TimeDelta timestamp_; | 283 base::TimeDelta timestamp_; |
277 | 284 |
| 285 base::Lock release_sync_point_lock_; |
| 286 uint32 release_sync_point_; |
| 287 |
278 const bool end_of_stream_; | 288 const bool end_of_stream_; |
279 | 289 |
280 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); | 290 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoFrame); |
281 }; | 291 }; |
282 | 292 |
283 } // namespace media | 293 } // namespace media |
284 | 294 |
285 #endif // MEDIA_BASE_VIDEO_FRAME_H_ | 295 #endif // MEDIA_BASE_VIDEO_FRAME_H_ |
OLD | NEW |