| 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/audio_buffer_resource.h" | 5 #include "ppapi/proxy/audio_buffer_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/media_stream_buffer.h" | 9 #include "ppapi/shared_impl/media_stream_buffer.h" |
| 10 #include "ppapi/shared_impl/var.h" | 10 #include "ppapi/shared_impl/var.h" |
| 11 | 11 |
| 12 namespace ppapi { | 12 namespace ppapi { |
| 13 namespace proxy { | 13 namespace proxy { |
| 14 | 14 |
| 15 AudioBufferResource::AudioBufferResource(PP_Instance instance, | 15 AudioBufferResource::AudioBufferResource(PP_Instance instance, |
| 16 int32_t index, | 16 int32_t index, |
| 17 MediaStreamBuffer* buffer) | 17 MediaStreamBuffer* buffer) |
| 18 : Resource(OBJECT_IS_PROXY, instance), | 18 : Resource(OBJECT_IS_PROXY, instance), |
| 19 index_(index), | 19 index_(index), |
| 20 buffer_(buffer) { | 20 buffer_(buffer) { |
| 21 DCHECK_EQ(buffer_->header.type, MediaStreamBuffer::TYPE_AUDIO); | 21 DCHECK_EQ(buffer_->header.type, MediaStreamBuffer::TYPE_AUDIO); |
| 22 } | 22 } |
| 23 | 23 |
| 24 AudioBufferResource::~AudioBufferResource() { | 24 AudioBufferResource::~AudioBufferResource() { |
| 25 CHECK(!buffer_) << "An unused (or unrecycled) buffer is destroyed."; | 25 // An unused (or unrecycled) buffer is destroyed. |
| 26 CHECK(!buffer_); |
| 26 } | 27 } |
| 27 | 28 |
| 28 thunk::PPB_AudioBuffer_API* AudioBufferResource::AsPPB_AudioBuffer_API() { | 29 thunk::PPB_AudioBuffer_API* AudioBufferResource::AsPPB_AudioBuffer_API() { |
| 29 return this; | 30 return this; |
| 30 } | 31 } |
| 31 | 32 |
| 32 PP_TimeDelta AudioBufferResource::GetTimestamp() { | 33 PP_TimeDelta AudioBufferResource::GetTimestamp() { |
| 33 if (!buffer_) { | 34 if (!buffer_) { |
| 34 VLOG(1) << "Buffer is invalid"; | 35 VLOG(1) << "Buffer is invalid"; |
| 35 return 0.0; | 36 return 0.0; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 104 |
| 104 void AudioBufferResource::Invalidate() { | 105 void AudioBufferResource::Invalidate() { |
| 105 DCHECK(buffer_); | 106 DCHECK(buffer_); |
| 106 DCHECK_GE(index_, 0); | 107 DCHECK_GE(index_, 0); |
| 107 buffer_ = NULL; | 108 buffer_ = NULL; |
| 108 index_ = -1; | 109 index_ = -1; |
| 109 } | 110 } |
| 110 | 111 |
| 111 } // namespace proxy | 112 } // namespace proxy |
| 112 } // namespace ppapi | 113 } // namespace ppapi |
| OLD | NEW |