Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Unified Diff: ppapi/proxy/media_stream_video_track_resource.cc

Issue 140783004: [PPAPI] Pepper MediaStream API audio track implementation and example. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix review issues Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/media_stream_audio_track_resource.cc ('k') | ppapi/proxy/plugin_var_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_|.
« no previous file with comments | « ppapi/proxy/media_stream_audio_track_resource.cc ('k') | ppapi/proxy/plugin_var_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698