X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fppapi%2Fproxy%2Fmedia_stream_video_track_resource.cc;h=451f259caad37f16c5a99d036a5867c4e5c3c573;hb=ff3e2503a20db9193d323c1d19c38c68004dec4a;hp=e8ab4c577251a44e0e3c54dbede7f2eb2dbe83b3;hpb=7338fba38ba696536d1cc9d389afd716a6ab2fe6;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/ppapi/proxy/media_stream_video_track_resource.cc b/src/ppapi/proxy/media_stream_video_track_resource.cc index e8ab4c5..451f259 100644 --- a/src/ppapi/proxy/media_stream_video_track_resource.cc +++ b/src/ppapi/proxy/media_stream_video_track_resource.cc @@ -6,7 +6,7 @@ #include "base/logging.h" #include "ppapi/proxy/video_frame_resource.h" -#include "ppapi/shared_impl/media_stream_frame.h" +#include "ppapi/shared_impl/media_stream_buffer.h" #include "ppapi/shared_impl/var.h" namespace ppapi { @@ -84,9 +84,9 @@ int32_t MediaStreamVideoTrackResource::RecycleFrame(PP_Resource frame) { if (has_ended()) return PP_OK; - DCHECK_GE(frame_resource->GetFrameBufferIndex(), 0); + DCHECK_GE(frame_resource->GetBufferIndex(), 0); - SendEnqueueFrameMessageToHost(frame_resource->GetFrameBufferIndex()); + SendEnqueueBufferMessageToHost(frame_resource->GetBufferIndex()); frame_resource->Invalidate(); return PP_OK; } @@ -106,23 +106,27 @@ void MediaStreamVideoTrackResource::Close() { MediaStreamTrackResourceBase::CloseInternal(); } -void MediaStreamVideoTrackResource::OnNewFrameEnqueued() { - if (TrackedCallback::IsPending(get_frame_callback_)) { - *get_frame_output_ = GetVideoFrame(); - get_frame_output_ = NULL; - scoped_refptr callback; - callback.swap(get_frame_callback_); - callback->Run(PP_OK); - } +void MediaStreamVideoTrackResource::OnNewBufferEnqueued() { + if (!TrackedCallback::IsPending(get_frame_callback_)) + return; + + *get_frame_output_ = GetVideoFrame(); + int32_t result = *get_frame_output_ ? PP_OK : PP_ERROR_FAILED; + get_frame_output_ = NULL; + scoped_refptr callback; + callback.swap(get_frame_callback_); + callback->Run(result); } PP_Resource MediaStreamVideoTrackResource::GetVideoFrame() { - int32_t index = frame_buffer()->DequeueFrame(); + int32_t index = buffer_manager()->DequeueBuffer(); if (index < 0) return 0; - MediaStreamFrame* frame = frame_buffer()->GetFramePointer(index); + + MediaStreamBuffer* buffer = buffer_manager()->GetBufferPointer(index); + DCHECK(buffer); scoped_refptr resource = - new VideoFrameResource(pp_instance(), index, frame); + new VideoFrameResource(pp_instance(), index, buffer); // Add |pp_resource()| and |resource| into |frames_|. // |frames_| uses scoped_ptr<> to hold a ref of |resource|. It keeps the // resource alive.