| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ppapi/proxy/video_frame_resource.h" | 5 #include "ppapi/proxy/video_frame_resource.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
| 9 #include "ppapi/shared_impl/var.h" | 9 #include "ppapi/shared_impl/var.h" |
| 10 | 10 |
| 11 namespace ppapi { | 11 namespace ppapi { |
| 12 namespace proxy { | 12 namespace proxy { |
| 13 | 13 |
| 14 VideoFrameResource::VideoFrameResource(PP_Instance instance, | 14 VideoFrameResource::VideoFrameResource(PP_Instance instance, |
| 15 int32_t index, | 15 int32_t index, |
| 16 MediaStreamBuffer* buffer) | 16 MediaStreamBuffer* buffer) |
| 17 : Resource(OBJECT_IS_PROXY, instance), | 17 : Resource(OBJECT_IS_PROXY, instance), |
| 18 index_(index), | 18 index_(index), |
| 19 buffer_(buffer) { | 19 buffer_(buffer) { |
| 20 DCHECK_EQ(buffer_->header.type, MediaStreamBuffer::TYPE_VIDEO); | 20 DCHECK_EQ(buffer_->header.type, MediaStreamBuffer::TYPE_VIDEO); |
| 21 } | 21 } |
| 22 | 22 |
| 23 VideoFrameResource::~VideoFrameResource() { | 23 VideoFrameResource::~VideoFrameResource() { |
| 24 CHECK(!buffer_) << "An unused (or unrecycled) frame is destroyed."; | 24 // An unused (or unrecycled) frame is destroyed. |
| 25 CHECK(!buffer_); |
| 25 } | 26 } |
| 26 | 27 |
| 27 thunk::PPB_VideoFrame_API* VideoFrameResource::AsPPB_VideoFrame_API() { | 28 thunk::PPB_VideoFrame_API* VideoFrameResource::AsPPB_VideoFrame_API() { |
| 28 return this; | 29 return this; |
| 29 } | 30 } |
| 30 | 31 |
| 31 PP_TimeDelta VideoFrameResource::GetTimestamp() { | 32 PP_TimeDelta VideoFrameResource::GetTimestamp() { |
| 32 if (!buffer_) { | 33 if (!buffer_) { |
| 33 VLOG(1) << "Frame is invalid"; | 34 VLOG(1) << "Frame is invalid"; |
| 34 return 0.0; | 35 return 0.0; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 88 |
| 88 void VideoFrameResource::Invalidate() { | 89 void VideoFrameResource::Invalidate() { |
| 89 DCHECK(buffer_); | 90 DCHECK(buffer_); |
| 90 DCHECK_GE(index_, 0); | 91 DCHECK_GE(index_, 0); |
| 91 buffer_ = NULL; | 92 buffer_ = NULL; |
| 92 index_ = -1; | 93 index_ = -1; |
| 93 } | 94 } |
| 94 | 95 |
| 95 } // namespace proxy | 96 } // namespace proxy |
| 96 } // namespace ppapi | 97 } // namespace ppapi |
| OLD | NEW |