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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 2749653003: Prototype HTMLVideoElement properties for WebGL texImage2D (Closed)
Patch Set: rebase Created 3 years, 9 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 | « media/blink/webmediaplayer_impl.h ('k') | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/webmediaplayer_impl.cc
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc
index 119810f9214b8611ebb33a8a391d5fc556132f9b..659c4cc32488ab013cc08c2058fd051c0415ed53 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -703,6 +703,15 @@ void WebMediaPlayerImpl::selectedVideoTrackChanged(
pipeline_controller_.OnSelectedVideoTrackChanged(selected_video_track_id);
}
+bool WebMediaPlayerImpl::getLastUploadedFrameInfo(unsigned* width,
+ unsigned* height,
+ double* timestamp) {
+ *width = last_uploaded_frame_size_.width();
+ *height = last_uploaded_frame_size_.height();
+ *timestamp = last_uploaded_frame_timestamp_.InSecondsF();
+ return true;
+}
+
blink::WebSize WebMediaPlayerImpl::naturalSize() const {
DCHECK(main_task_runner_->BelongsToCurrentThread());
@@ -1833,8 +1842,16 @@ scoped_refptr<VideoFrame> WebMediaPlayerImpl::GetCurrentFrameFromCompositor() {
// Needed when the |main_task_runner_| and |compositor_task_runner_| are the
// same to avoid deadlock in the Wait() below.
- if (compositor_task_runner_->BelongsToCurrentThread())
- return compositor_->GetCurrentFrameAndUpdateIfStale();
+ if (compositor_task_runner_->BelongsToCurrentThread()) {
+ scoped_refptr<VideoFrame> video_frame =
+ compositor_->GetCurrentFrameAndUpdateIfStale();
+ if (!video_frame) {
+ return nullptr;
+ }
+ last_uploaded_frame_size_ = video_frame->natural_size();
+ last_uploaded_frame_timestamp_ = video_frame->timestamp();
+ return video_frame;
+ }
// Use a posted task and waitable event instead of a lock otherwise
// WebGL/Canvas can see different content than what the compositor is seeing.
@@ -1846,6 +1863,12 @@ scoped_refptr<VideoFrame> WebMediaPlayerImpl::GetCurrentFrameFromCompositor() {
base::Bind(&GetCurrentFrameAndSignal, base::Unretained(compositor_),
&video_frame, &event));
event.Wait();
+
+ if (!video_frame) {
+ return nullptr;
+ }
+ last_uploaded_frame_size_ = video_frame->natural_size();
+ last_uploaded_frame_timestamp_ = video_frame->timestamp();
return video_frame;
}
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698