| Index: content/common/gpu/ca_layer_tree_mac.mm
|
| diff --git a/content/common/gpu/ca_layer_tree_mac.mm b/content/common/gpu/ca_layer_tree_mac.mm
|
| index cac3dfe9ac10de8a00793e059a96180838d3e06c..5e696ac304f3b582d3e92080cea46704bfcdf6a2 100644
|
| --- a/content/common/gpu/ca_layer_tree_mac.mm
|
| +++ b/content/common/gpu/ca_layer_tree_mac.mm
|
| @@ -142,9 +142,12 @@ bool CALayerTree::ScheduleCALayer(
|
| background_color, edge_aa_mask, opacity);
|
| }
|
|
|
| -void CALayerTree::CommitScheduledCALayers(CALayer* superlayer,
|
| - scoped_ptr<CALayerTree> old_tree,
|
| - float scale_factor) {
|
| +void CALayerTree::CommitScheduledCALayers(
|
| + CALayer* superlayer,
|
| + bool* use_detached_video_layer,
|
| + AVSampleBufferDisplayLayer* detached_video_layer,
|
| + scoped_ptr<CALayerTree> old_tree,
|
| + float scale_factor) {
|
| TRACE_EVENT0("gpu", "CALayerTree::CommitScheduledCALayers");
|
| RootLayer* old_root_layer = nullptr;
|
| if (old_tree) {
|
| @@ -153,6 +156,41 @@ void CALayerTree::CommitScheduledCALayers(CALayer* superlayer,
|
| old_root_layer = &old_tree->root_layer_;
|
| }
|
|
|
| + // Do the video check.
|
| + {
|
| + bool all_before_black = true;
|
| + bool found_video = false;
|
| + bool nothing_after = true;
|
| + ContentLayer* video_layer = nullptr;
|
| +
|
| + for (auto& clip_layer : root_layer_.clip_and_sorting_layers) {
|
| + for (auto& transform_layer : clip_layer.transform_layers) {
|
| + for (auto& content_layer : transform_layer.content_layers) {
|
| + if (all_before_black) {
|
| + if (found_video) {
|
| + nothing_after = false;
|
| + }
|
| + if (content_layer.use_av_layer) {
|
| + found_video = true;
|
| + video_layer = &content_layer;
|
| + } else if (content_layer.background_color & 0x00FFFFFF) {
|
| + all_before_black = false;
|
| + }
|
| + }
|
| + }
|
| + }
|
| + }
|
| + printf("bb:%d fv:%d na:%d\n", all_before_black, found_video, nothing_after);
|
| + if (all_before_black && found_video && nothing_after) {
|
| + printf("YES TO DETACHED MODE!!!\n");
|
| + *use_detached_video_layer = true;
|
| + AVSampleBufferDisplayLayerEnqueueIOSurface(detached_video_layer, video_layer->io_surface);
|
| + } else {
|
| + *use_detached_video_layer = false;
|
| + }
|
| + }
|
| +
|
| +
|
| root_layer_.CommitToCA(superlayer, old_root_layer, scale_factor);
|
| // If there are any extra CALayers in |old_tree| that were not stolen by this
|
| // tree, they will be removed from the CALayer tree in this deallocation.
|
|
|