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

Side by Side Diff: content/renderer/media/webmediaplayer_ms.cc

Issue 1964253002: Bug Fix: Rendering stuck due to thread issue of WebMediaPlayerMSCompositor (M51) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/renderer/media/webmediaplayer_ms_compositor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/webmediaplayer_ms.h" 5 #include "content/renderer/media/webmediaplayer_ms.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 return true; 318 return true;
319 } 319 }
320 320
321 void WebMediaPlayerMS::paint(blink::WebCanvas* canvas, 321 void WebMediaPlayerMS::paint(blink::WebCanvas* canvas,
322 const blink::WebRect& rect, 322 const blink::WebRect& rect,
323 unsigned char alpha, 323 unsigned char alpha,
324 SkXfermode::Mode mode) { 324 SkXfermode::Mode mode) {
325 DVLOG(3) << __FUNCTION__; 325 DVLOG(3) << __FUNCTION__;
326 DCHECK(thread_checker_.CalledOnValidThread()); 326 DCHECK(thread_checker_.CalledOnValidThread());
327 327
328 const scoped_refptr<media::VideoFrame> frame = compositor_->GetCurrentFrame(); 328 const scoped_refptr<media::VideoFrame> frame =
329 compositor_->GetCurrentFrameWithoutUpdatingStatistics();
329 330
330 media::Context3D context_3d; 331 media::Context3D context_3d;
331 if (frame && frame->HasTextures()) { 332 if (frame && frame->HasTextures()) {
332 cc::ContextProvider* provider = 333 cc::ContextProvider* provider =
333 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); 334 RenderThreadImpl::current()->SharedMainThreadContextProvider().get();
334 // GPU Process crashed. 335 // GPU Process crashed.
335 if (!provider) 336 if (!provider)
336 return; 337 return;
337 context_3d = media::Context3D(provider->ContextGL(), provider->GrContext()); 338 context_3d = media::Context3D(provider->ContextGL(), provider->GrContext());
338 DCHECK(context_3d.gl); 339 DCHECK(context_3d.gl);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 bool WebMediaPlayerMS::copyVideoTextureToPlatformTexture( 443 bool WebMediaPlayerMS::copyVideoTextureToPlatformTexture(
443 gpu::gles2::GLES2Interface* gl, 444 gpu::gles2::GLES2Interface* gl,
444 unsigned int texture, 445 unsigned int texture,
445 unsigned int internal_format, 446 unsigned int internal_format,
446 unsigned int type, 447 unsigned int type,
447 bool premultiply_alpha, 448 bool premultiply_alpha,
448 bool flip_y) { 449 bool flip_y) {
449 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture"); 450 TRACE_EVENT0("media", "WebMediaPlayerMS:copyVideoTextureToPlatformTexture");
450 DCHECK(thread_checker_.CalledOnValidThread()); 451 DCHECK(thread_checker_.CalledOnValidThread());
451 452
452 scoped_refptr<media::VideoFrame> video_frame = compositor_->GetCurrentFrame(); 453 scoped_refptr<media::VideoFrame> video_frame =
454 compositor_->GetCurrentFrameWithoutUpdatingStatistics();
453 455
454 if (!video_frame.get() || !video_frame->HasTextures() || 456 if (!video_frame.get() || !video_frame->HasTextures() ||
455 media::VideoFrame::NumPlanes(video_frame->format()) != 1) { 457 media::VideoFrame::NumPlanes(video_frame->format()) != 1) {
456 return false; 458 return false;
457 } 459 }
458 460
459 media::SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture( 461 media::SkCanvasVideoRenderer::CopyVideoFrameSingleTextureToGLTexture(
460 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha, 462 gl, video_frame.get(), texture, internal_format, type, premultiply_alpha,
461 flip_y); 463 flip_y);
462 return true; 464 return true;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 void WebMediaPlayerMS::ResetCanvasCache() { 531 void WebMediaPlayerMS::ResetCanvasCache() {
530 DCHECK(thread_checker_.CalledOnValidThread()); 532 DCHECK(thread_checker_.CalledOnValidThread());
531 video_renderer_.ResetCache(); 533 video_renderer_.ResetCache();
532 } 534 }
533 535
534 void WebMediaPlayerMS::TriggerResize() { 536 void WebMediaPlayerMS::TriggerResize() {
535 get_client()->sizeChanged(); 537 get_client()->sizeChanged();
536 } 538 }
537 539
538 } // namespace content 540 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/webmediaplayer_ms_compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698