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

Side by Side Diff: cc/resources/video_resource_updater.cc

Issue 175223003: HW Video: Make media::VideoFrame handle the sync point of the compositor as well as webgl (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: previous patchset has unrelated code by mistake. Created 6 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 unified diff | Download patch
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 "cc/resources/video_resource_updater.h" 5 #include "cc/resources/video_resource_updater.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "cc/output/gl_renderer.h" 8 #include "cc/output/gl_renderer.h"
9 #include "cc/resources/resource_provider.h" 9 #include "cc/resources/resource_provider.h"
10 #include "gpu/GLES2/gl2extchromium.h" 10 #include "gpu/GLES2/gl2extchromium.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 base::Bind(&RecycleResource, AsWeakPtr(), recycle_data)); 304 base::Bind(&RecycleResource, AsWeakPtr(), recycle_data));
305 } 305 }
306 306
307 external_resources.type = VideoFrameExternalResources::YUV_RESOURCE; 307 external_resources.type = VideoFrameExternalResources::YUV_RESOURCE;
308 return external_resources; 308 return external_resources;
309 } 309 }
310 310
311 static void ReturnTexture(const scoped_refptr<media::VideoFrame>& frame, 311 static void ReturnTexture(const scoped_refptr<media::VideoFrame>& frame,
312 uint32 sync_point, 312 uint32 sync_point,
313 bool lost_resource) { 313 bool lost_resource) {
314 frame->mailbox_holder()->sync_point = sync_point; 314 frame->AppendReleaseSyncPoint(sync_point);
315 } 315 }
316 316
317 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( 317 VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes(
318 const scoped_refptr<media::VideoFrame>& video_frame) { 318 const scoped_refptr<media::VideoFrame>& video_frame) {
319 media::VideoFrame::Format frame_format = video_frame->format(); 319 media::VideoFrame::Format frame_format = video_frame->format();
320 320
321 DCHECK_EQ(frame_format, media::VideoFrame::NATIVE_TEXTURE); 321 DCHECK_EQ(frame_format, media::VideoFrame::NATIVE_TEXTURE);
322 if (frame_format != media::VideoFrame::NATIVE_TEXTURE) 322 if (frame_format != media::VideoFrame::NATIVE_TEXTURE)
323 return VideoFrameExternalResources(); 323 return VideoFrameExternalResources();
324 324
(...skipping 11 matching lines...) Expand all
336 VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE; 336 VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE;
337 break; 337 break;
338 case GL_TEXTURE_RECTANGLE_ARB: 338 case GL_TEXTURE_RECTANGLE_ARB:
339 external_resources.type = VideoFrameExternalResources::IO_SURFACE; 339 external_resources.type = VideoFrameExternalResources::IO_SURFACE;
340 break; 340 break;
341 default: 341 default:
342 NOTREACHED(); 342 NOTREACHED();
343 return VideoFrameExternalResources(); 343 return VideoFrameExternalResources();
344 } 344 }
345 345
346 // Don't share the mailbox of the video frame with the compositor, because
danakj 2014/03/06 19:31:31 What does this comment mean?
dshwang 2014/03/06 19:51:37 Sorry for broken explanation. ResourceProvider act
347 // the mailbox of the video frame can be read by another thread. i.e. webgl
346 external_resources.mailboxes.push_back( 348 external_resources.mailboxes.push_back(
347 TextureMailbox(mailbox_holder->mailbox, 349 TextureMailbox(mailbox_holder->mailbox,
348 mailbox_holder->texture_target, 350 mailbox_holder->texture_target,
349 mailbox_holder->sync_point)); 351 mailbox_holder->sync_point));
350 external_resources.release_callbacks.push_back( 352 external_resources.release_callbacks.push_back(
351 base::Bind(&ReturnTexture, video_frame)); 353 base::Bind(&ReturnTexture, video_frame));
352 return external_resources; 354 return external_resources;
353 } 355 }
354 356
355 // static 357 // static
(...skipping 27 matching lines...) Expand all
383 } 385 }
384 386
385 PlaneResource recycled_resource(data.resource_id, 387 PlaneResource recycled_resource(data.resource_id,
386 data.resource_size, 388 data.resource_size,
387 data.resource_format, 389 data.resource_format,
388 data.mailbox); 390 data.mailbox);
389 updater->recycled_resources_.push_back(recycled_resource); 391 updater->recycled_resources_.push_back(recycled_resource);
390 } 392 }
391 393
392 } // namespace cc 394 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698