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

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

Issue 1960563002: Add media::VideoFrame::WrapNativeTextures() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.cc ('k') | media/base/video_frame.h » ('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 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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 DCHECK(decoder_texture_target_); 425 DCHECK(decoder_texture_target_);
426 // Convert timestamp from 90KHz to ms. 426 // Convert timestamp from 90KHz to ms.
427 base::TimeDelta timestamp_ms = base::TimeDelta::FromInternalValue( 427 base::TimeDelta timestamp_ms = base::TimeDelta::FromInternalValue(
428 base::checked_cast<uint64_t>(timestamp) * 1000 / 90); 428 base::checked_cast<uint64_t>(timestamp) * 1000 / 90);
429 // TODO(mcasas): The incoming data may actually be in a YUV format, but may be 429 // TODO(mcasas): The incoming data may actually be in a YUV format, but may be
430 // labelled as ARGB. This may or may not be reported by VDA, depending on 430 // labelled as ARGB. This may or may not be reported by VDA, depending on
431 // whether it provides an implementation of VDA::GetOutputFormat(). 431 // whether it provides an implementation of VDA::GetOutputFormat().
432 // This prevents the compositor from messing with it, since the underlying 432 // This prevents the compositor from messing with it, since the underlying
433 // platform can handle the former format natively. Make sure the 433 // platform can handle the former format natively. Make sure the
434 // correct format is used and everyone down the line understands it. 434 // correct format is used and everyone down the line understands it.
435 scoped_refptr<media::VideoFrame> frame = media::VideoFrame::WrapNativeTexture( 435 gpu::MailboxHolder holders[media::VideoFrame::kMaxPlanes] = {
436 pixel_format, gpu::MailboxHolder(pb.texture_mailbox(0), gpu::SyncToken(), 436 gpu::MailboxHolder(pb.texture_mailbox(0), gpu::SyncToken(),
437 decoder_texture_target_), 437 decoder_texture_target_)};
438 media::BindToCurrentLoop(base::Bind( 438 scoped_refptr<media::VideoFrame> frame =
439 &RTCVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(), 439 media::VideoFrame::WrapNativeTextures(
440 factories_, picture.picture_buffer_id(), pb.texture_ids()[0])), 440 pixel_format, holders,
441 pb.size(), visible_rect, visible_rect.size(), timestamp_ms); 441 media::BindToCurrentLoop(base::Bind(
442 &RTCVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(),
443 factories_, picture.picture_buffer_id(), pb.texture_ids()[0])),
444 pb.size(), visible_rect, visible_rect.size(), timestamp_ms);
442 if (frame && picture.allow_overlay()) { 445 if (frame && picture.allow_overlay()) {
443 frame->metadata()->SetBoolean(media::VideoFrameMetadata::ALLOW_OVERLAY, 446 frame->metadata()->SetBoolean(media::VideoFrameMetadata::ALLOW_OVERLAY,
444 true); 447 true);
445 } 448 }
446 return frame; 449 return frame;
447 } 450 }
448 451
449 void RTCVideoDecoder::NotifyEndOfBitstreamBuffer(int32_t id) { 452 void RTCVideoDecoder::NotifyEndOfBitstreamBuffer(int32_t id) {
450 DVLOG(3) << "NotifyEndOfBitstreamBuffer. id=" << id; 453 DVLOG(3) << "NotifyEndOfBitstreamBuffer. id=" << id;
451 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); 454 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 861
859 void RTCVideoDecoder::TryResetVDAErrorCounter_Locked() { 862 void RTCVideoDecoder::TryResetVDAErrorCounter_Locked() {
860 lock_.AssertAcquired(); 863 lock_.AssertAcquired();
861 864
862 if (vda_error_counter_ == 0) 865 if (vda_error_counter_ == 0)
863 return; 866 return;
864 vda_error_counter_ = 0; 867 vda_error_counter_ = 0;
865 } 868 }
866 869
867 } // namespace content 870 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/android/webmediaplayer_android.cc ('k') | media/base/video_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698