Commit 8d78aa3c authored by dongseong.hwang's avatar dongseong.hwang Committed by Commit bot

WebRTC: One WebRTC Video can have both SW and HW VideoFrame.

SkCanvasVideoRenderer assumes that the VideoFrames belonging to one WebRTC
video are always either software VideoFrame or hardware VideoFrame.
However, it's not true. VideoFrame can be changed each frame.

TEST=content_browsertests WebRtcBrowserTest.CallAndVerify* on Nexus5
BUG=448014

Review URL: https://codereview.chromium.org/848683003

Cr-Commit-Position: refs/heads/master@{#311468}
parent 4343be3a
...@@ -429,10 +429,14 @@ void SkCanvasVideoRenderer::Paint(const scoped_refptr<VideoFrame>& video_frame, ...@@ -429,10 +429,14 @@ void SkCanvasVideoRenderer::Paint(const scoped_refptr<VideoFrame>& video_frame,
if (accelerated_last_frame_.isNull() || if (accelerated_last_frame_.isNull() ||
video_frame->timestamp() != accelerated_last_frame_timestamp_) { video_frame->timestamp() != accelerated_last_frame_timestamp_) {
if (video_frame->format() == VideoFrame::NATIVE_TEXTURE) { if (video_frame->format() == VideoFrame::NATIVE_TEXTURE) {
// Draw HW Video on HW Canvas.
DCHECK(context_3d.gl); DCHECK(context_3d.gl);
DCHECK(context_3d.gr_context); DCHECK(context_3d.gr_context);
// Draw HW Video on HW Canvas. if (accelerated_generator_) {
DCHECK(!accelerated_generator_); // Reset SkBitmap used in SWVideo-to-HWCanvas path.
accelerated_last_frame_.reset();
accelerated_generator_ = nullptr;
}
if (!CopyVideoFrameTextureToSkBitmapTexture( if (!CopyVideoFrameTextureToSkBitmapTexture(
video_frame.get(), &accelerated_last_frame_, context_3d)) { video_frame.get(), &accelerated_last_frame_, context_3d)) {
NOTREACHED(); NOTREACHED();
...@@ -440,6 +444,10 @@ void SkCanvasVideoRenderer::Paint(const scoped_refptr<VideoFrame>& video_frame, ...@@ -440,6 +444,10 @@ void SkCanvasVideoRenderer::Paint(const scoped_refptr<VideoFrame>& video_frame,
} }
} else { } else {
// Draw SW Video on HW Canvas. // Draw SW Video on HW Canvas.
if (!accelerated_generator_ && !accelerated_last_frame_.isNull()) {
// Reset SkBitmap used in HWVideo-to-HWCanvas path.
accelerated_last_frame_.reset();
}
accelerated_generator_ = new VideoImageGenerator(video_frame); accelerated_generator_ = new VideoImageGenerator(video_frame);
// Note: This takes ownership of |accelerated_generator_|. // Note: This takes ownership of |accelerated_generator_|.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment