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