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

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

Issue 1688033005: Monitor VideoResourceUpdater reusing destructed resource in Debug mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and add new VideoFrameMetada field. Created 4 years, 10 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 mailbox(mailbox), 125 mailbox(mailbox),
126 ref_count(0), 126 ref_count(0),
127 frame_ptr(nullptr), 127 frame_ptr(nullptr),
128 plane_index(0u) { 128 plane_index(0u) {
129 } 129 }
130 130
131 bool VideoResourceUpdater::PlaneResourceMatchesUniqueID( 131 bool VideoResourceUpdater::PlaneResourceMatchesUniqueID(
132 const PlaneResource& plane_resource, 132 const PlaneResource& plane_resource,
133 const media::VideoFrame* video_frame, 133 const media::VideoFrame* video_frame,
134 size_t plane_index) { 134 size_t plane_index) {
135 return plane_resource.frame_ptr == video_frame && 135 if (plane_resource.frame_ptr == video_frame &&
136 plane_resource.plane_index == plane_index && 136 plane_resource.plane_index == plane_index &&
137 plane_resource.timestamp == video_frame->timestamp(); 137 plane_resource.timestamp == video_frame->timestamp()) {
138 bool video_frame_in_resource;
miu 2016/02/22 21:17:37 There's a helper method in VideoFrameMetadata to a
xjz 2016/02/23 03:36:03 Done.
139 if (video_frame->metadata()->GetBoolean(
140 media::VideoFrameMetadata::RESOURCE_UPDATER_FLAG,
141 &video_frame_in_resource))
142 return video_frame_in_resource;
143 else
144 return false;
145 }
146 return false;
138 } 147 }
139 148
140 void VideoResourceUpdater::SetPlaneResourceUniqueId( 149 void VideoResourceUpdater::SetPlaneResourceUniqueId(
141 const media::VideoFrame* video_frame, 150 media::VideoFrame* video_frame,
142 size_t plane_index, 151 size_t plane_index,
143 PlaneResource* plane_resource) { 152 PlaneResource* plane_resource) {
144 plane_resource->frame_ptr = video_frame; 153 plane_resource->frame_ptr = video_frame;
145 plane_resource->plane_index = plane_index; 154 plane_resource->plane_index = plane_index;
146 plane_resource->timestamp = video_frame->timestamp(); 155 plane_resource->timestamp = video_frame->timestamp();
156 video_frame->metadata()->SetBoolean(
157 media::VideoFrameMetadata::RESOURCE_UPDATER_FLAG, true);
147 } 158 }
148 159
149 VideoFrameExternalResources::VideoFrameExternalResources() 160 VideoFrameExternalResources::VideoFrameExternalResources()
150 : type(NONE), 161 : type(NONE),
151 read_lock_fences_enabled(false), 162 read_lock_fences_enabled(false),
152 offset(0.0f), 163 offset(0.0f),
153 multiplier(1.0f) {} 164 multiplier(1.0f) {}
154 165
155 VideoFrameExternalResources::~VideoFrameExternalResources() {} 166 VideoFrameExternalResources::~VideoFrameExternalResources() {}
156 167
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 resource_it->ref_count = 0; 692 resource_it->ref_count = 0;
682 updater->DeleteResource(resource_it); 693 updater->DeleteResource(resource_it);
683 return; 694 return;
684 } 695 }
685 696
686 --resource_it->ref_count; 697 --resource_it->ref_count;
687 DCHECK_GE(resource_it->ref_count, 0); 698 DCHECK_GE(resource_it->ref_count, 0);
688 } 699 }
689 700
690 } // namespace cc 701 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698