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

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

Issue 1117423002: media: Let VideoFrame carry more than one native texture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address reveman's comments. Created 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Notes about usage of this object by VideoCaptureImplManager. 5 // Notes about usage of this object by VideoCaptureImplManager.
6 // 6 //
7 // VideoCaptureImplManager access this object by using a Unretained() 7 // VideoCaptureImplManager access this object by using a Unretained()
8 // binding and tasks on the IO thread. It is then important that 8 // binding and tasks on the IO thread. It is then important that
9 // VideoCaptureImpl never post task to itself. All operations must be 9 // VideoCaptureImpl never post task to itself. All operations must be
10 // synchronous. 10 // synchronous.
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 269
270 if (state_ != VIDEO_CAPTURE_STATE_STARTED || suspended_) { 270 if (state_ != VIDEO_CAPTURE_STATE_STARTED || suspended_) {
271 Send(new VideoCaptureHostMsg_BufferReady(device_id_, buffer_id, 0)); 271 Send(new VideoCaptureHostMsg_BufferReady(device_id_, buffer_id, 0));
272 return; 272 return;
273 } 273 }
274 274
275 if (first_frame_timestamp_.is_null()) 275 if (first_frame_timestamp_.is_null())
276 first_frame_timestamp_ = timestamp; 276 first_frame_timestamp_ = timestamp;
277 277
278 scoped_refptr<media::VideoFrame> frame = media::VideoFrame::WrapNativeTexture( 278 scoped_refptr<media::VideoFrame> frame = media::VideoFrame::WrapNativeTexture(
279 make_scoped_ptr(new gpu::MailboxHolder(mailbox_holder)), 279 mailbox_holder,
280 media::BindToCurrentLoop(base::Bind( 280 media::BindToCurrentLoop(base::Bind(
281 &VideoCaptureImpl::OnClientBufferFinished, weak_factory_.GetWeakPtr(), 281 &VideoCaptureImpl::OnClientBufferFinished, weak_factory_.GetWeakPtr(),
282 buffer_id, scoped_refptr<ClientBuffer>())), 282 buffer_id, scoped_refptr<ClientBuffer>())),
283 packed_frame_size, gfx::Rect(packed_frame_size), packed_frame_size, 283 packed_frame_size, gfx::Rect(packed_frame_size), packed_frame_size,
284 timestamp - first_frame_timestamp_, false); 284 timestamp - first_frame_timestamp_, false);
285 frame->metadata()->MergeInternalValuesFrom(metadata); 285 frame->metadata()->MergeInternalValuesFrom(metadata);
286 286
287 for (const auto& client : clients_) 287 for (const auto& client : clients_)
288 client.second.deliver_frame_cb.Run(frame, timestamp); 288 client.second.deliver_frame_cb.Run(frame, timestamp);
289 } 289 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 const ClientInfoMap::iterator it = clients->find(client_id); 420 const ClientInfoMap::iterator it = clients->find(client_id);
421 if (it != clients->end()) { 421 if (it != clients->end()) {
422 it->second.state_update_cb.Run(VIDEO_CAPTURE_STATE_STOPPED); 422 it->second.state_update_cb.Run(VIDEO_CAPTURE_STATE_STOPPED);
423 clients->erase(it); 423 clients->erase(it);
424 found = true; 424 found = true;
425 } 425 }
426 return found; 426 return found;
427 } 427 }
428 428
429 } // namespace content 429 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698