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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 } | 665 } |
666 | 666 |
667 factories_->WaitSyncPoint(mailbox_holder->sync_point); | 667 factories_->WaitSyncPoint(mailbox_holder->sync_point); |
668 | 668 |
669 vda_->ReusePictureBuffer(picture_buffer_id); | 669 vda_->ReusePictureBuffer(picture_buffer_id); |
670 } | 670 } |
671 | 671 |
672 void RTCVideoDecoder::CreateVDA(media::VideoCodecProfile profile, | 672 void RTCVideoDecoder::CreateVDA(media::VideoCodecProfile profile, |
673 base::WaitableEvent* waiter) { | 673 base::WaitableEvent* waiter) { |
674 DCHECK(vda_task_runner_->BelongsToCurrentThread()); | 674 DCHECK(vda_task_runner_->BelongsToCurrentThread()); |
675 vda_ = factories_->CreateVideoDecodeAccelerator(profile, this); | 675 vda_ = factories_->CreateVideoDecodeAccelerator(profile); |
| 676 if (vda_ && !vda_->Initialize(this, profile)) |
| 677 vda_.release()->Destroy(); |
676 waiter->Signal(); | 678 waiter->Signal(); |
677 } | 679 } |
678 | 680 |
679 void RTCVideoDecoder::DestroyTextures() { | 681 void RTCVideoDecoder::DestroyTextures() { |
680 DCHECK(vda_task_runner_->BelongsToCurrentThread()); | 682 DCHECK(vda_task_runner_->BelongsToCurrentThread()); |
681 std::map<int32, media::PictureBuffer>::iterator it; | 683 std::map<int32, media::PictureBuffer>::iterator it; |
682 | 684 |
683 for (it = assigned_picture_buffers_.begin(); | 685 for (it = assigned_picture_buffers_.begin(); |
684 it != assigned_picture_buffers_.end(); | 686 it != assigned_picture_buffers_.end(); |
685 ++it) { | 687 ++it) { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 | 786 |
785 int32_t RTCVideoDecoder::RecordInitDecodeUMA(int32_t status) { | 787 int32_t RTCVideoDecoder::RecordInitDecodeUMA(int32_t status) { |
786 // Logging boolean is enough to know if HW decoding has been used. Also, | 788 // Logging boolean is enough to know if HW decoding has been used. Also, |
787 // InitDecode is less likely to return an error so enum is not used here. | 789 // InitDecode is less likely to return an error so enum is not used here. |
788 bool sample = (status == WEBRTC_VIDEO_CODEC_OK) ? true : false; | 790 bool sample = (status == WEBRTC_VIDEO_CODEC_OK) ? true : false; |
789 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoDecoderInitDecodeSuccess", sample); | 791 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoDecoderInitDecodeSuccess", sample); |
790 return status; | 792 return status; |
791 } | 793 } |
792 | 794 |
793 } // namespace content | 795 } // namespace content |
OLD | NEW |