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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 reset_bitstream_buffer_id_ = ID_LAST; | 284 reset_bitstream_buffer_id_ = ID_LAST; |
285 // If VDA is already resetting, no need to request the reset again. | 285 // If VDA is already resetting, no need to request the reset again. |
286 if (state_ != RESETTING) { | 286 if (state_ != RESETTING) { |
287 state_ = RESETTING; | 287 state_ = RESETTING; |
288 vda_task_runner_->PostTask( | 288 vda_task_runner_->PostTask( |
289 FROM_HERE, base::Bind(&RTCVideoDecoder::ResetInternal, weak_this_)); | 289 FROM_HERE, base::Bind(&RTCVideoDecoder::ResetInternal, weak_this_)); |
290 } | 290 } |
291 return WEBRTC_VIDEO_CODEC_OK; | 291 return WEBRTC_VIDEO_CODEC_OK; |
292 } | 292 } |
293 | 293 |
294 void RTCVideoDecoder::NotifyInitializeDone() { | |
295 DVLOG(2) << "NotifyInitializeDone"; | |
296 NOTREACHED(); | |
297 } | |
298 | |
299 void RTCVideoDecoder::ProvidePictureBuffers(uint32 count, | 294 void RTCVideoDecoder::ProvidePictureBuffers(uint32 count, |
300 const gfx::Size& size, | 295 const gfx::Size& size, |
301 uint32 texture_target) { | 296 uint32 texture_target) { |
302 DCHECK(vda_task_runner_->BelongsToCurrentThread()); | 297 DCHECK(vda_task_runner_->BelongsToCurrentThread()); |
303 DVLOG(3) << "ProvidePictureBuffers. texture_target=" << texture_target; | 298 DVLOG(3) << "ProvidePictureBuffers. texture_target=" << texture_target; |
304 | 299 |
305 if (!vda_) | 300 if (!vda_) |
306 return; | 301 return; |
307 | 302 |
308 std::vector<uint32> texture_ids; | 303 std::vector<uint32> texture_ids; |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 } | 658 } |
664 | 659 |
665 factories_->WaitSyncPoint(mailbox_holder->sync_point); | 660 factories_->WaitSyncPoint(mailbox_holder->sync_point); |
666 | 661 |
667 vda_->ReusePictureBuffer(picture_buffer_id); | 662 vda_->ReusePictureBuffer(picture_buffer_id); |
668 } | 663 } |
669 | 664 |
670 void RTCVideoDecoder::CreateVDA(media::VideoCodecProfile profile, | 665 void RTCVideoDecoder::CreateVDA(media::VideoCodecProfile profile, |
671 base::WaitableEvent* waiter) { | 666 base::WaitableEvent* waiter) { |
672 DCHECK(vda_task_runner_->BelongsToCurrentThread()); | 667 DCHECK(vda_task_runner_->BelongsToCurrentThread()); |
673 vda_ = factories_->CreateVideoDecodeAccelerator(profile); | 668 vda_ = factories_->CreateVideoDecodeAccelerator(); |
674 if (vda_ && !vda_->Initialize(profile, this)) | 669 if (vda_ && !vda_->Initialize(profile, this)) |
675 vda_.release()->Destroy(); | 670 vda_.release()->Destroy(); |
676 waiter->Signal(); | 671 waiter->Signal(); |
677 } | 672 } |
678 | 673 |
679 void RTCVideoDecoder::DestroyTextures() { | 674 void RTCVideoDecoder::DestroyTextures() { |
680 DCHECK(vda_task_runner_->BelongsToCurrentThread()); | 675 DCHECK(vda_task_runner_->BelongsToCurrentThread()); |
681 std::map<int32, media::PictureBuffer>::iterator it; | 676 std::map<int32, media::PictureBuffer>::iterator it; |
682 | 677 |
683 for (it = assigned_picture_buffers_.begin(); | 678 for (it = assigned_picture_buffers_.begin(); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 | 779 |
785 int32_t RTCVideoDecoder::RecordInitDecodeUMA(int32_t status) { | 780 int32_t RTCVideoDecoder::RecordInitDecodeUMA(int32_t status) { |
786 // Logging boolean is enough to know if HW decoding has been used. Also, | 781 // 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. | 782 // InitDecode is less likely to return an error so enum is not used here. |
788 bool sample = (status == WEBRTC_VIDEO_CODEC_OK) ? true : false; | 783 bool sample = (status == WEBRTC_VIDEO_CODEC_OK) ? true : false; |
789 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoDecoderInitDecodeSuccess", sample); | 784 UMA_HISTOGRAM_BOOLEAN("Media.RTCVideoDecoderInitDecodeSuccess", sample); |
790 return status; | 785 return status; |
791 } | 786 } |
792 | 787 |
793 } // namespace content | 788 } // namespace content |
OLD | NEW |