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

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

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added DCHECK for valid sync token before IPC conversions Created 5 years, 1 month 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/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 DCHECK(decoder_texture_target_); 412 DCHECK(decoder_texture_target_);
413 // Convert timestamp from 90KHz to ms. 413 // Convert timestamp from 90KHz to ms.
414 base::TimeDelta timestamp_ms = base::TimeDelta::FromInternalValue( 414 base::TimeDelta timestamp_ms = base::TimeDelta::FromInternalValue(
415 base::checked_cast<uint64_t>(timestamp) * 1000 / 90); 415 base::checked_cast<uint64_t>(timestamp) * 1000 / 90);
416 // TODO(mcasas): The incoming data is actually a YUV format, but is labelled 416 // TODO(mcasas): The incoming data is actually a YUV format, but is labelled
417 // as ARGB. This prevents the compositor from messing with it, since the 417 // as ARGB. This prevents the compositor from messing with it, since the
418 // underlying platform can handle the former format natively. Make sure the 418 // underlying platform can handle the former format natively. Make sure the
419 // correct format is used and everyone down the line understands it. 419 // correct format is used and everyone down the line understands it.
420 scoped_refptr<media::VideoFrame> frame(media::VideoFrame::WrapNativeTexture( 420 scoped_refptr<media::VideoFrame> frame(media::VideoFrame::WrapNativeTexture(
421 media::PIXEL_FORMAT_ARGB, 421 media::PIXEL_FORMAT_ARGB,
422 gpu::MailboxHolder(pb.texture_mailbox(), decoder_texture_target_, 0), 422 gpu::MailboxHolder(pb.texture_mailbox(), gpu::SyncToken(),
423 decoder_texture_target_),
423 media::BindToCurrentLoop(base::Bind( 424 media::BindToCurrentLoop(base::Bind(
424 &RTCVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(), 425 &RTCVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(),
425 factories_, picture.picture_buffer_id(), pb.texture_id())), 426 factories_, picture.picture_buffer_id(), pb.texture_id())),
426 pb.size(), visible_rect, visible_rect.size(), timestamp_ms)); 427 pb.size(), visible_rect, visible_rect.size(), timestamp_ms));
427 if (picture.allow_overlay()) { 428 if (picture.allow_overlay()) {
428 frame->metadata()->SetBoolean(media::VideoFrameMetadata::ALLOW_OVERLAY, 429 frame->metadata()->SetBoolean(media::VideoFrameMetadata::ALLOW_OVERLAY,
429 true); 430 true);
430 } 431 }
431 return frame; 432 return frame;
432 } 433 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 if (vda_) 618 if (vda_)
618 vda_->Reset(); 619 vda_->Reset();
619 } 620 }
620 621
621 // static 622 // static
622 void RTCVideoDecoder::ReleaseMailbox( 623 void RTCVideoDecoder::ReleaseMailbox(
623 base::WeakPtr<RTCVideoDecoder> decoder, 624 base::WeakPtr<RTCVideoDecoder> decoder,
624 media::GpuVideoAcceleratorFactories* factories, 625 media::GpuVideoAcceleratorFactories* factories,
625 int64 picture_buffer_id, 626 int64 picture_buffer_id,
626 uint32 texture_id, 627 uint32 texture_id,
627 uint32 release_sync_point) { 628 const gpu::SyncToken& release_sync_token) {
628 DCHECK(factories->GetTaskRunner()->BelongsToCurrentThread()); 629 DCHECK(factories->GetTaskRunner()->BelongsToCurrentThread());
629 factories->WaitSyncPoint(release_sync_point); 630 factories->WaitSyncToken(release_sync_token);
630 631
631 if (decoder) { 632 if (decoder) {
632 decoder->ReusePictureBuffer(picture_buffer_id); 633 decoder->ReusePictureBuffer(picture_buffer_id);
633 return; 634 return;
634 } 635 }
635 // It's the last chance to delete the texture after display, 636 // It's the last chance to delete the texture after display,
636 // because RTCVideoDecoder was destructed. 637 // because RTCVideoDecoder was destructed.
637 factories->DeleteTexture(texture_id); 638 factories->DeleteTexture(texture_id);
638 } 639 }
639 640
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 for (std::deque<std::pair<webrtc::EncodedImage, BufferData>>::iterator it = 826 for (std::deque<std::pair<webrtc::EncodedImage, BufferData>>::iterator it =
826 pending_buffers_.begin(); 827 pending_buffers_.begin();
827 it != pending_buffers_.end(); ++it) { 828 it != pending_buffers_.end(); ++it) {
828 delete[] it->first._buffer; 829 delete[] it->first._buffer;
829 } 830 }
830 831
831 pending_buffers_.clear(); 832 pending_buffers_.clear();
832 } 833 }
833 834
834 } // namespace content 835 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698