| Index: ppapi/proxy/audio_frame_resource.cc
|
| diff --git a/ppapi/proxy/audio_frame_resource.cc b/ppapi/proxy/audio_frame_resource.cc
|
| index 4954857239a750dd7b49fe691034295663df1e84..0827df742d457bb794dd1b4d227a092eee294735 100644
|
| --- a/ppapi/proxy/audio_frame_resource.cc
|
| +++ b/ppapi/proxy/audio_frame_resource.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "base/logging.h"
|
| #include "ppapi/c/pp_bool.h"
|
| +#include "ppapi/shared_impl/media_stream_buffer.h"
|
| #include "ppapi/shared_impl/var.h"
|
|
|
| namespace ppapi {
|
| @@ -13,15 +14,15 @@ namespace proxy {
|
|
|
| AudioFrameResource::AudioFrameResource(PP_Instance instance,
|
| int32_t index,
|
| - MediaStreamFrame* frame)
|
| + MediaStreamBuffer* buffer)
|
| : Resource(OBJECT_IS_PROXY, instance),
|
| index_(index),
|
| - frame_(frame) {
|
| - DCHECK_EQ(frame_->header.type, MediaStreamFrame::TYPE_AUDIO);
|
| + buffer_(buffer) {
|
| + DCHECK_EQ(buffer_->header.type, MediaStreamBuffer::TYPE_AUDIO);
|
| }
|
|
|
| AudioFrameResource::~AudioFrameResource() {
|
| - CHECK(!frame_) << "An unused (or unrecycled) frame is destroyed.";
|
| + CHECK(!buffer_) << "An unused (or unrecycled) frame is destroyed.";
|
| }
|
|
|
| thunk::PPB_AudioFrame_API* AudioFrameResource::AsPPB_AudioFrame_API() {
|
| @@ -29,81 +30,81 @@ thunk::PPB_AudioFrame_API* AudioFrameResource::AsPPB_AudioFrame_API() {
|
| }
|
|
|
| PP_TimeDelta AudioFrameResource::GetTimestamp() {
|
| - if (!frame_) {
|
| - VLOG(1) << "Frame is invalid";
|
| + if (!buffer_) {
|
| + VLOG(1) << "Buffer is invalid";
|
| return 0.0;
|
| }
|
| - return frame_->audio.timestamp;
|
| + return buffer_->audio.timestamp;
|
| }
|
|
|
| void AudioFrameResource::SetTimestamp(PP_TimeDelta timestamp) {
|
| - if (!frame_) {
|
| - VLOG(1) << "Frame is invalid";
|
| + if (!buffer_) {
|
| + VLOG(1) << "Buffer is invalid";
|
| return;
|
| }
|
| - frame_->audio.timestamp = timestamp;
|
| + buffer_->audio.timestamp = timestamp;
|
| }
|
|
|
| PP_AudioFrame_SampleRate AudioFrameResource::GetSampleRate() {
|
| - if (!frame_) {
|
| - VLOG(1) << "Frame is invalid";
|
| + if (!buffer_) {
|
| + VLOG(1) << "Buffer is invalid";
|
| return PP_AUDIOFRAME_SAMPLERATE_UNKNOWN;
|
| }
|
| - return frame_->audio.sample_rate;
|
| + return buffer_->audio.sample_rate;
|
| }
|
|
|
| PP_AudioFrame_SampleSize AudioFrameResource::GetSampleSize() {
|
| - if (!frame_) {
|
| - VLOG(1) << "Frame is invalid";
|
| + if (!buffer_) {
|
| + VLOG(1) << "Buffer is invalid";
|
| return PP_AUDIOFRAME_SAMPLESIZE_UNKNOWN;
|
| }
|
| return PP_AUDIOFRAME_SAMPLESIZE_16_BITS;
|
| }
|
|
|
| uint32_t AudioFrameResource::GetNumberOfChannels() {
|
| - if (!frame_) {
|
| - VLOG(1) << "Frame is invalid";
|
| + if (!buffer_) {
|
| + VLOG(1) << "Buffer is invalid";
|
| return 0;
|
| }
|
| - return frame_->audio.number_of_channels;
|
| + return buffer_->audio.number_of_channels;
|
| }
|
|
|
| uint32_t AudioFrameResource::GetNumberOfSamples() {
|
| - if (!frame_) {
|
| - VLOG(1) << "Frame is invalid";
|
| + if (!buffer_) {
|
| + VLOG(1) << "Buffer is invalid";
|
| return 0;
|
| }
|
| - return frame_->audio.number_of_samples;
|
| + return buffer_->audio.number_of_samples;
|
| }
|
|
|
| void* AudioFrameResource::GetDataBuffer() {
|
| - if (!frame_) {
|
| - VLOG(1) << "Frame is invalid";
|
| + if (!buffer_) {
|
| + VLOG(1) << "Buffer is invalid";
|
| return NULL;
|
| }
|
| - return frame_->audio.data;
|
| + return buffer_->audio.data;
|
| }
|
|
|
| uint32_t AudioFrameResource::GetDataBufferSize() {
|
| - if (!frame_) {
|
| - VLOG(1) << "Frame is invalid";
|
| + if (!buffer_) {
|
| + VLOG(1) << "Buffer is invalid";
|
| return 0;
|
| }
|
| - return frame_->audio.data_size;
|
| + return buffer_->audio.data_size;
|
| }
|
|
|
| -MediaStreamFrame* AudioFrameResource::GetFrameBuffer() {
|
| - return frame_;
|
| +MediaStreamBuffer* AudioFrameResource::GetBuffer() {
|
| + return buffer_;
|
| }
|
|
|
| -int32_t AudioFrameResource::GetFrameBufferIndex() {
|
| +int32_t AudioFrameResource::GetBufferIndex() {
|
| return index_;
|
| }
|
|
|
| void AudioFrameResource::Invalidate() {
|
| - DCHECK(frame_);
|
| + DCHECK(buffer_);
|
| DCHECK_GE(index_, 0);
|
| - frame_ = NULL;
|
| + buffer_ = NULL;
|
| index_ = -1;
|
| }
|
|
|
|
|