Index: ppapi/proxy/media_stream_video_track_resource.cc |
diff --git a/ppapi/proxy/media_stream_video_track_resource.cc b/ppapi/proxy/media_stream_video_track_resource.cc |
index e8ab4c577251a44e0e3c54dbede7f2eb2dbe83b3..804df00d88f5d90b423f69cde2407190b338d93a 100644 |
--- a/ppapi/proxy/media_stream_video_track_resource.cc |
+++ b/ppapi/proxy/media_stream_video_track_resource.cc |
@@ -107,20 +107,24 @@ void MediaStreamVideoTrackResource::Close() { |
} |
void MediaStreamVideoTrackResource::OnNewFrameEnqueued() { |
- if (TrackedCallback::IsPending(get_frame_callback_)) { |
- *get_frame_output_ = GetVideoFrame(); |
- get_frame_output_ = NULL; |
- scoped_refptr<TrackedCallback> callback; |
- callback.swap(get_frame_callback_); |
- callback->Run(PP_OK); |
- } |
+ 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<TrackedCallback> callback; |
+ callback.swap(get_frame_callback_); |
+ callback->Run(result); |
} |
PP_Resource MediaStreamVideoTrackResource::GetVideoFrame() { |
int32_t index = frame_buffer()->DequeueFrame(); |
if (index < 0) |
return 0; |
+ |
MediaStreamFrame* frame = frame_buffer()->GetFramePointer(index); |
+ DCHECK(frame); |
scoped_refptr<VideoFrameResource> resource = |
new VideoFrameResource(pp_instance(), index, frame); |
// Add |pp_resource()| and |resource| into |frames_|. |