OLD | NEW |
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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 gpu::MailboxHolder(pb.texture_mailbox(), decoder_texture_target_, 0), | 423 gpu::MailboxHolder(pb.texture_mailbox(), decoder_texture_target_, 0), |
424 media::BindToCurrentLoop(base::Bind( | 424 media::BindToCurrentLoop(base::Bind( |
425 &RTCVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(), | 425 &RTCVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(), |
426 factories_, picture.picture_buffer_id(), pb.texture_id())), | 426 factories_, picture.picture_buffer_id(), pb.texture_id())), |
427 pb.size(), visible_rect, visible_rect.size(), timestamp_ms, | 427 pb.size(), visible_rect, visible_rect.size(), timestamp_ms, |
428 picture.allow_overlay()); | 428 picture.allow_overlay(), true /* has_alpha */); |
429 } | 429 } |
430 | 430 |
431 void RTCVideoDecoder::NotifyEndOfBitstreamBuffer(int32 id) { | 431 void RTCVideoDecoder::NotifyEndOfBitstreamBuffer(int32 id) { |
432 DVLOG(3) << "NotifyEndOfBitstreamBuffer. id=" << id; | 432 DVLOG(3) << "NotifyEndOfBitstreamBuffer. id=" << id; |
433 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 433 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
434 | 434 |
435 std::map<int32, SHMBuffer*>::iterator it = | 435 std::map<int32, SHMBuffer*>::iterator it = |
436 bitstream_buffers_in_decoder_.find(id); | 436 bitstream_buffers_in_decoder_.find(id); |
437 if (it == bitstream_buffers_in_decoder_.end()) { | 437 if (it == bitstream_buffers_in_decoder_.end()) { |
438 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | 438 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoDecoderInitDecodeSuccess", sample); | 778 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoDecoderInitDecodeSuccess", sample); |
779 return status; | 779 return status; |
780 } | 780 } |
781 | 781 |
782 void RTCVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 782 void RTCVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
783 const { | 783 const { |
784 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 784 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
785 } | 785 } |
786 | 786 |
787 } // namespace content | 787 } // namespace content |
OLD | NEW |