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

Side by Side Diff: content/browser/renderer_host/media/video_capture_buffer_pool.cc

Issue 12537014: Make SharedMemory track the size that was actually mapped (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/renderer_host/media/audio_sync_reader.cc ('k') | ui/surface/surface.gyp » ('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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/browser/renderer_host/media/video_capture_buffer_pool.h" 5 #include "content/browser/renderer_host/media/video_capture_buffer_pool.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/base/video_util.h" 10 #include "media/base/video_util.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 if (!candidate->consumer_hold_count && !candidate->held_by_producer) { 58 if (!candidate->consumer_hold_count && !candidate->held_by_producer) {
59 buffer_id = candidate_id; 59 buffer_id = candidate_id;
60 break; 60 break;
61 } 61 }
62 } 62 }
63 if (!buffer_id) 63 if (!buffer_id)
64 return NULL; 64 return NULL;
65 65
66 Buffer* buffer = buffers_[buffer_id]; 66 Buffer* buffer = buffers_[buffer_id];
67 67
68 CHECK_GE(buffer->shared_memory.created_size(), GetMemorySize()); 68 CHECK_GE(buffer->shared_memory.requested_size(), GetMemorySize());
69 69
70 // Complete the reservation. 70 // Complete the reservation.
71 buffer->held_by_producer = true; 71 buffer->held_by_producer = true;
72 base::Closure disposal_handler = base::Bind( 72 base::Closure disposal_handler = base::Bind(
73 &VideoCaptureBufferPool::OnVideoFrameDestroyed, this, buffer_id); 73 &VideoCaptureBufferPool::OnVideoFrameDestroyed, this, buffer_id);
74 74
75 // Wrap the buffer in a VideoFrame container. 75 // Wrap the buffer in a VideoFrame container.
76 uint8* base_ptr = static_cast<uint8*>(buffer->shared_memory.memory()); 76 uint8* base_ptr = static_cast<uint8*>(buffer->shared_memory.memory());
77 size_t u_offset = size_.GetArea(); 77 size_t u_offset = size_.GetArea();
78 size_t v_offset = u_offset + u_offset / 4; 78 size_t v_offset = u_offset + u_offset / 4;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 buffer->held_by_producer = false; 172 buffer->held_by_producer = false;
173 } 173 }
174 174
175 bool VideoCaptureBufferPool::IsAllocated() const { 175 bool VideoCaptureBufferPool::IsAllocated() const {
176 lock_.AssertAcquired(); 176 lock_.AssertAcquired();
177 return !buffers_.empty(); 177 return !buffers_.empty();
178 } 178 }
179 179
180 } // namespace content 180 } // namespace content
181 181
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/audio_sync_reader.cc ('k') | ui/surface/surface.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698