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

Side by Side Diff: content/renderer/media/rtc_video_decoder.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 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 "content/renderer/media/rtc_video_decoder.h" 5 #include "content/renderer/media/rtc_video_decoder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 scoped_refptr<media::VideoFrame> RTCVideoDecoder::CreateVideoFrame( 413 scoped_refptr<media::VideoFrame> RTCVideoDecoder::CreateVideoFrame(
414 const media::Picture& picture, 414 const media::Picture& picture,
415 const media::PictureBuffer& pb, 415 const media::PictureBuffer& pb,
416 uint32_t timestamp) { 416 uint32_t timestamp) {
417 gfx::Rect visible_rect(picture.visible_rect()); 417 gfx::Rect visible_rect(picture.visible_rect());
418 DCHECK(decoder_texture_target_); 418 DCHECK(decoder_texture_target_);
419 // Convert timestamp from 90KHz to ms. 419 // Convert timestamp from 90KHz to ms.
420 base::TimeDelta timestamp_ms = base::TimeDelta::FromInternalValue( 420 base::TimeDelta timestamp_ms = base::TimeDelta::FromInternalValue(
421 base::checked_cast<uint64_t>(timestamp) * 1000 / 90); 421 base::checked_cast<uint64_t>(timestamp) * 1000 / 90);
422 return media::VideoFrame::WrapNativeTexture( 422 return media::VideoFrame::WrapNativeTexture(
423 make_scoped_ptr(new gpu::MailboxHolder(pb.texture_mailbox(), 423 gpu::MailboxHolder(pb.texture_mailbox(), decoder_texture_target_, 0),
424 decoder_texture_target_, 0)),
425 media::BindToCurrentLoop(base::Bind( 424 media::BindToCurrentLoop(base::Bind(
426 &RTCVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(), 425 &RTCVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(),
427 factories_, picture.picture_buffer_id(), pb.texture_id())), 426 factories_, picture.picture_buffer_id(), pb.texture_id())),
428 pb.size(), visible_rect, visible_rect.size(), timestamp_ms, 427 pb.size(), visible_rect, visible_rect.size(), timestamp_ms,
429 picture.allow_overlay()); 428 picture.allow_overlay());
430 } 429 }
431 430
432 void RTCVideoDecoder::NotifyEndOfBitstreamBuffer(int32 id) { 431 void RTCVideoDecoder::NotifyEndOfBitstreamBuffer(int32 id) {
433 DVLOG(3) << "NotifyEndOfBitstreamBuffer. id=" << id; 432 DVLOG(3) << "NotifyEndOfBitstreamBuffer. id=" << id;
434 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); 433 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoDecoderInitDecodeSuccess", sample); 778 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoDecoderInitDecodeSuccess", sample);
780 return status; 779 return status;
781 } 780 }
782 781
783 void RTCVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() 782 void RTCVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent()
784 const { 783 const {
785 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); 784 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread());
786 } 785 }
787 786
788 } // namespace content 787 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698