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

Side by Side Diff: content/browser/renderer_host/media/video_capture_device_client.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_device_client.h" 5 #include "content/browser/renderer_host/media/video_capture_device_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "content/browser/compositor/image_transport_factory.h" 10 #include "content/browser/compositor/image_transport_factory.h"
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 GL_BGRA_EXT); 542 GL_BGRA_EXT);
543 DCHECK(image_id); 543 DCHECK(image_id);
544 544
545 GLuint texture_id = gl_helper_->CreateTexture(); 545 GLuint texture_id = gl_helper_->CreateTexture();
546 DCHECK(texture_id); 546 DCHECK(texture_id);
547 { 547 {
548 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl, texture_id); 548 content::ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl, texture_id);
549 gl->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id); 549 gl->BindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id);
550 } 550 }
551 551
552 scoped_ptr<gpu::MailboxHolder> mailbox_holder(new gpu::MailboxHolder( 552 const gpu::MailboxHolder& mailbox_holder(
553 gl_helper_->ProduceMailboxHolderFromTexture(texture_id))); 553 gl_helper_->ProduceMailboxHolderFromTexture(texture_id));
554 DCHECK(!mailbox_holder->mailbox.IsZero()); 554 DCHECK(!mailbox_holder.mailbox.IsZero());
555 DCHECK(mailbox_holder->mailbox.Verify()); 555 DCHECK(mailbox_holder.mailbox.Verify());
556 DCHECK(mailbox_holder->texture_target); 556 DCHECK(mailbox_holder.texture_target);
557 DCHECK(mailbox_holder->sync_point); 557 DCHECK(mailbox_holder.sync_point);
558 558
559 scoped_refptr<media::VideoFrame> video_frame = 559 scoped_refptr<media::VideoFrame> video_frame =
560 media::VideoFrame::WrapNativeTexture( 560 media::VideoFrame::WrapNativeTexture(
561 mailbox_holder.Pass(), 561 mailbox_holder,
562 media::BindToCurrentLoop( 562 media::BindToCurrentLoop(base::Bind(
563 base::Bind(&VideoCaptureDeviceClient::TextureWrapHelper:: 563 &VideoCaptureDeviceClient::TextureWrapHelper::ReleaseCallback,
564 ReleaseCallback, 564 this, image_id, texture_id)),
565 this, image_id, texture_id)), 565 frame_format.frame_size, gfx::Rect(frame_format.frame_size),
566 frame_format.frame_size, 566 frame_format.frame_size, base::TimeDelta(), true /* allow_overlay */);
567 gfx::Rect(frame_format.frame_size),
568 frame_format.frame_size,
569 base::TimeDelta(),
570 true /* allow_overlay */);
571 video_frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE, 567 video_frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE,
572 frame_format.frame_rate); 568 frame_format.frame_rate);
573 569
574 BrowserThread::PostTask( 570 BrowserThread::PostTask(
575 BrowserThread::IO, FROM_HERE, 571 BrowserThread::IO, FROM_HERE,
576 base::Bind( 572 base::Bind(
577 &VideoCaptureController::DoIncomingCapturedVideoFrameOnIOThread, 573 &VideoCaptureController::DoIncomingCapturedVideoFrameOnIOThread,
578 controller_, base::Passed(&buffer), video_frame, timestamp)); 574 controller_, base::Passed(&buffer), video_frame, timestamp));
579 } 575 }
580 576
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 void VideoCaptureDeviceClient::TextureWrapHelper::OnError( 660 void VideoCaptureDeviceClient::TextureWrapHelper::OnError(
665 const std::string& message) { 661 const std::string& message) {
666 DCHECK(capture_task_runner_->BelongsToCurrentThread()); 662 DCHECK(capture_task_runner_->BelongsToCurrentThread());
667 DLOG(ERROR) << message; 663 DLOG(ERROR) << message;
668 BrowserThread::PostTask( 664 BrowserThread::PostTask(
669 BrowserThread::IO, FROM_HERE, 665 BrowserThread::IO, FROM_HERE,
670 base::Bind(&VideoCaptureController::DoErrorOnIOThread, controller_)); 666 base::Bind(&VideoCaptureController::DoErrorOnIOThread, controller_));
671 } 667 }
672 668
673 } // namespace content 669 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698