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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 2749653003: Prototype HTMLVideoElement properties for WebGL texImage2D (Closed)
Patch Set: update 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
Index: media/blink/webmediaplayer_impl.cc
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc
index 813a643f7cf0fc1e93183549f5163e3738b9889f..2dc413db109786c881801f81bd955bd672f6b1d9 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -702,6 +702,15 @@ void WebMediaPlayerImpl::selectedVideoTrackChanged(
pipeline_controller_.OnSelectedVideoTrackChanged(selected_video_track_id);
}
+bool WebMediaPlayerImpl::getLastUploadedFrameInfo(unsigned* width,
+ unsigned* height,
+ double* timestamp) {
+ *width = last_uploaded_frame_width_;
+ *height = last_uploaded_frame_height_;
+ *timestamp = last_uploaded_frame_timestamp_;
+ return true;
+}
+
blink::WebSize WebMediaPlayerImpl::naturalSize() const {
DCHECK(main_task_runner_->BelongsToCurrentThread());
@@ -894,6 +903,8 @@ void WebMediaPlayerImpl::paint(blink::WebCanvas* canvas,
scoped_refptr<VideoFrame> video_frame = GetCurrentFrameFromCompositor();
+ UpdateLastUploadedFrameInfo(video_frame.get());
+
gfx::Rect gfx_rect(rect);
Context3D context_3d;
if (video_frame.get() && video_frame->HasTextures()) {
@@ -972,6 +983,8 @@ bool WebMediaPlayerImpl::copyVideoTextureToPlatformTexture(
return false;
}
+ UpdateLastUploadedFrameInfo(video_frame.get());
+
Context3D context_3d;
if (!context_3d_cb_.is_null())
context_3d = context_3d_cb_.Run();
@@ -2326,4 +2339,17 @@ void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) {
UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration);
}
+void WebMediaPlayerImpl::UpdateLastUploadedFrameInfo(VideoFrame* video_frame) {
+ if (!video_frame) {
+ last_uploaded_frame_width_ = 0;
+ last_uploaded_frame_height_ = 0;
+ last_uploaded_frame_timestamp_ = 0.0;
+ return;
+ }
+
+ last_uploaded_frame_width_ = video_frame->natural_size().width();
+ last_uploaded_frame_height_ = video_frame->natural_size().height();
+ last_uploaded_frame_timestamp_ = video_frame->timestamp().InSecondsF();
+}
+
} // namespace media

Powered by Google App Engine
This is Rietveld 408576698