OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/gpu/media/vaapi_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/vaapi_video_decode_accelerator.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/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 }; | 199 }; |
200 | 200 |
201 VaapiVideoDecodeAccelerator::InputBuffer::InputBuffer() : id(0), size(0) { | 201 VaapiVideoDecodeAccelerator::InputBuffer::InputBuffer() : id(0), size(0) { |
202 } | 202 } |
203 | 203 |
204 VaapiVideoDecodeAccelerator::InputBuffer::~InputBuffer() { | 204 VaapiVideoDecodeAccelerator::InputBuffer::~InputBuffer() { |
205 } | 205 } |
206 | 206 |
207 void VaapiVideoDecodeAccelerator::NotifyError(Error error) { | 207 void VaapiVideoDecodeAccelerator::NotifyError(Error error) { |
208 if (message_loop_ != base::MessageLoop::current()) { | 208 if (message_loop_ != base::MessageLoop::current()) { |
209 DCHECK(decoder_thread_proxy_->BelongsToCurrentThread()); | 209 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); |
210 message_loop_->PostTask(FROM_HERE, base::Bind( | 210 message_loop_->PostTask(FROM_HERE, base::Bind( |
211 &VaapiVideoDecodeAccelerator::NotifyError, weak_this_, error)); | 211 &VaapiVideoDecodeAccelerator::NotifyError, weak_this_, error)); |
212 return; | 212 return; |
213 } | 213 } |
214 | 214 |
215 // Post Cleanup() as a task so we don't recursively acquire lock_. | 215 // Post Cleanup() as a task so we don't recursively acquire lock_. |
216 message_loop_->PostTask(FROM_HERE, base::Bind( | 216 message_loop_->PostTask(FROM_HERE, base::Bind( |
217 &VaapiVideoDecodeAccelerator::Cleanup, weak_this_)); | 217 &VaapiVideoDecodeAccelerator::Cleanup, weak_this_)); |
218 | 218 |
219 LOG(ERROR) << "Notifying of error " << error; | 219 LOG(ERROR) << "Notifying of error " << error; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 } else if (profile >= media::VP8PROFILE_MIN && | 300 } else if (profile >= media::VP8PROFILE_MIN && |
301 profile <= media::VP8PROFILE_MAX) { | 301 profile <= media::VP8PROFILE_MAX) { |
302 vp8_accelerator_.reset(new VaapiVP8Accelerator(this, vaapi_wrapper_.get())); | 302 vp8_accelerator_.reset(new VaapiVP8Accelerator(this, vaapi_wrapper_.get())); |
303 decoder_.reset(new VP8Decoder(vp8_accelerator_.get())); | 303 decoder_.reset(new VP8Decoder(vp8_accelerator_.get())); |
304 } else { | 304 } else { |
305 DLOG(ERROR) << "Unsupported profile " << profile; | 305 DLOG(ERROR) << "Unsupported profile " << profile; |
306 return false; | 306 return false; |
307 } | 307 } |
308 | 308 |
309 CHECK(decoder_thread_.Start()); | 309 CHECK(decoder_thread_.Start()); |
310 decoder_thread_proxy_ = decoder_thread_.message_loop_proxy(); | 310 decoder_thread_task_runner_ = decoder_thread_.task_runner(); |
311 | 311 |
312 state_ = kIdle; | 312 state_ = kIdle; |
313 return true; | 313 return true; |
314 } | 314 } |
315 | 315 |
316 void VaapiVideoDecodeAccelerator::OutputPicture( | 316 void VaapiVideoDecodeAccelerator::OutputPicture( |
317 const scoped_refptr<VASurface>& va_surface, | 317 const scoped_refptr<VASurface>& va_surface, |
318 int32 input_id, | 318 int32 input_id, |
319 VaapiPicture* picture) { | 319 VaapiPicture* picture) { |
320 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 320 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 392 |
393 ++num_stream_bufs_at_decoder_; | 393 ++num_stream_bufs_at_decoder_; |
394 TRACE_COUNTER1("Video Decoder", "Stream buffers at decoder", | 394 TRACE_COUNTER1("Video Decoder", "Stream buffers at decoder", |
395 num_stream_bufs_at_decoder_); | 395 num_stream_bufs_at_decoder_); |
396 | 396 |
397 input_buffers_.push(input_buffer); | 397 input_buffers_.push(input_buffer); |
398 input_ready_.Signal(); | 398 input_ready_.Signal(); |
399 } | 399 } |
400 | 400 |
401 bool VaapiVideoDecodeAccelerator::GetInputBuffer_Locked() { | 401 bool VaapiVideoDecodeAccelerator::GetInputBuffer_Locked() { |
402 DCHECK(decoder_thread_proxy_->BelongsToCurrentThread()); | 402 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); |
403 lock_.AssertAcquired(); | 403 lock_.AssertAcquired(); |
404 | 404 |
405 if (curr_input_buffer_.get()) | 405 if (curr_input_buffer_.get()) |
406 return true; | 406 return true; |
407 | 407 |
408 // Will only wait if it is expected that in current state new buffers will | 408 // Will only wait if it is expected that in current state new buffers will |
409 // be queued from the client via Decode(). The state can change during wait. | 409 // be queued from the client via Decode(). The state can change during wait. |
410 while (input_buffers_.empty() && (state_ == kDecoding || state_ == kIdle)) { | 410 while (input_buffers_.empty() && (state_ == kDecoding || state_ == kIdle)) { |
411 input_ready_.Wait(); | 411 input_ready_.Wait(); |
412 } | 412 } |
(...skipping 25 matching lines...) Expand all Loading... |
438 | 438 |
439 default: | 439 default: |
440 // We got woken up due to being destroyed/reset, ignore any already | 440 // We got woken up due to being destroyed/reset, ignore any already |
441 // queued inputs. | 441 // queued inputs. |
442 return false; | 442 return false; |
443 } | 443 } |
444 } | 444 } |
445 | 445 |
446 void VaapiVideoDecodeAccelerator::ReturnCurrInputBuffer_Locked() { | 446 void VaapiVideoDecodeAccelerator::ReturnCurrInputBuffer_Locked() { |
447 lock_.AssertAcquired(); | 447 lock_.AssertAcquired(); |
448 DCHECK(decoder_thread_proxy_->BelongsToCurrentThread()); | 448 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); |
449 DCHECK(curr_input_buffer_.get()); | 449 DCHECK(curr_input_buffer_.get()); |
450 | 450 |
451 int32 id = curr_input_buffer_->id; | 451 int32 id = curr_input_buffer_->id; |
452 curr_input_buffer_.reset(); | 452 curr_input_buffer_.reset(); |
453 DVLOG(4) << "End of input buffer " << id; | 453 DVLOG(4) << "End of input buffer " << id; |
454 message_loop_->PostTask(FROM_HERE, base::Bind( | 454 message_loop_->PostTask(FROM_HERE, base::Bind( |
455 &Client::NotifyEndOfBitstreamBuffer, client_, id)); | 455 &Client::NotifyEndOfBitstreamBuffer, client_, id)); |
456 | 456 |
457 --num_stream_bufs_at_decoder_; | 457 --num_stream_bufs_at_decoder_; |
458 TRACE_COUNTER1("Video Decoder", "Stream buffers at decoder", | 458 TRACE_COUNTER1("Video Decoder", "Stream buffers at decoder", |
459 num_stream_bufs_at_decoder_); | 459 num_stream_bufs_at_decoder_); |
460 } | 460 } |
461 | 461 |
462 // TODO(posciak): refactor the whole class to remove sleeping in wait for | 462 // TODO(posciak): refactor the whole class to remove sleeping in wait for |
463 // surfaces, and reschedule DecodeTask instead. | 463 // surfaces, and reschedule DecodeTask instead. |
464 bool VaapiVideoDecodeAccelerator::WaitForSurfaces_Locked() { | 464 bool VaapiVideoDecodeAccelerator::WaitForSurfaces_Locked() { |
465 lock_.AssertAcquired(); | 465 lock_.AssertAcquired(); |
466 DCHECK(decoder_thread_proxy_->BelongsToCurrentThread()); | 466 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); |
467 | 467 |
468 while (available_va_surfaces_.empty() && | 468 while (available_va_surfaces_.empty() && |
469 (state_ == kDecoding || state_ == kFlushing || state_ == kIdle)) { | 469 (state_ == kDecoding || state_ == kFlushing || state_ == kIdle)) { |
470 surfaces_available_.Wait(); | 470 surfaces_available_.Wait(); |
471 } | 471 } |
472 | 472 |
473 if (state_ != kDecoding && state_ != kFlushing && state_ != kIdle) | 473 if (state_ != kDecoding && state_ != kFlushing && state_ != kIdle) |
474 return false; | 474 return false; |
475 | 475 |
476 return true; | 476 return true; |
477 } | 477 } |
478 | 478 |
479 void VaapiVideoDecodeAccelerator::DecodeTask() { | 479 void VaapiVideoDecodeAccelerator::DecodeTask() { |
480 DCHECK(decoder_thread_proxy_->BelongsToCurrentThread()); | 480 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); |
481 TRACE_EVENT0("Video Decoder", "VAVDA::DecodeTask"); | 481 TRACE_EVENT0("Video Decoder", "VAVDA::DecodeTask"); |
482 base::AutoLock auto_lock(lock_); | 482 base::AutoLock auto_lock(lock_); |
483 | 483 |
484 if (state_ != kDecoding) | 484 if (state_ != kDecoding) |
485 return; | 485 return; |
486 | 486 |
487 // Main decode task. | 487 // Main decode task. |
488 DVLOG(4) << "Decode task"; | 488 DVLOG(4) << "Decode task"; |
489 | 489 |
490 // Try to decode what stream data is (still) in the decoder until we run out | 490 // Try to decode what stream data is (still) in the decoder until we run out |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 TRACE_EVENT1("Video Decoder", "VAVDA::Decode", "Buffer id", | 603 TRACE_EVENT1("Video Decoder", "VAVDA::Decode", "Buffer id", |
604 bitstream_buffer.id()); | 604 bitstream_buffer.id()); |
605 | 605 |
606 // We got a new input buffer from the client, map it and queue for later use. | 606 // We got a new input buffer from the client, map it and queue for later use. |
607 MapAndQueueNewInputBuffer(bitstream_buffer); | 607 MapAndQueueNewInputBuffer(bitstream_buffer); |
608 | 608 |
609 base::AutoLock auto_lock(lock_); | 609 base::AutoLock auto_lock(lock_); |
610 switch (state_) { | 610 switch (state_) { |
611 case kIdle: | 611 case kIdle: |
612 state_ = kDecoding; | 612 state_ = kDecoding; |
613 decoder_thread_proxy_->PostTask(FROM_HERE, base::Bind( | 613 decoder_thread_task_runner_->PostTask( |
614 &VaapiVideoDecodeAccelerator::DecodeTask, | 614 FROM_HERE, base::Bind(&VaapiVideoDecodeAccelerator::DecodeTask, |
615 base::Unretained(this))); | 615 base::Unretained(this))); |
616 break; | 616 break; |
617 | 617 |
618 case kDecoding: | 618 case kDecoding: |
619 // Decoder already running, fallthrough. | 619 // Decoder already running, fallthrough. |
620 case kResetting: | 620 case kResetting: |
621 // When resetting, allow accumulating bitstream buffers, so that | 621 // When resetting, allow accumulating bitstream buffers, so that |
622 // the client can queue after-seek-buffers while we are finishing with | 622 // the client can queue after-seek-buffers while we are finishing with |
623 // the before-seek one. | 623 // the before-seek one. |
624 break; | 624 break; |
625 | 625 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 bool inserted = | 686 bool inserted = |
687 pictures_.insert(std::make_pair(buffers[i].id(), picture)).second; | 687 pictures_.insert(std::make_pair(buffers[i].id(), picture)).second; |
688 DCHECK(inserted); | 688 DCHECK(inserted); |
689 | 689 |
690 output_buffers_.push(buffers[i].id()); | 690 output_buffers_.push(buffers[i].id()); |
691 available_va_surfaces_.push_back(va_surface_ids[i]); | 691 available_va_surfaces_.push_back(va_surface_ids[i]); |
692 surfaces_available_.Signal(); | 692 surfaces_available_.Signal(); |
693 } | 693 } |
694 | 694 |
695 state_ = kDecoding; | 695 state_ = kDecoding; |
696 decoder_thread_proxy_->PostTask(FROM_HERE, base::Bind( | 696 decoder_thread_task_runner_->PostTask( |
697 &VaapiVideoDecodeAccelerator::DecodeTask, base::Unretained(this))); | 697 FROM_HERE, base::Bind(&VaapiVideoDecodeAccelerator::DecodeTask, |
| 698 base::Unretained(this))); |
698 } | 699 } |
699 | 700 |
700 void VaapiVideoDecodeAccelerator::ReusePictureBuffer(int32 picture_buffer_id) { | 701 void VaapiVideoDecodeAccelerator::ReusePictureBuffer(int32 picture_buffer_id) { |
701 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 702 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
702 TRACE_EVENT1("Video Decoder", "VAVDA::ReusePictureBuffer", "Picture id", | 703 TRACE_EVENT1("Video Decoder", "VAVDA::ReusePictureBuffer", "Picture id", |
703 picture_buffer_id); | 704 picture_buffer_id); |
704 | 705 |
705 --num_frames_at_client_; | 706 --num_frames_at_client_; |
706 TRACE_COUNTER1("Video Decoder", "Textures at client", num_frames_at_client_); | 707 TRACE_COUNTER1("Video Decoder", "Textures at client", num_frames_at_client_); |
707 | 708 |
708 output_buffers_.push(picture_buffer_id); | 709 output_buffers_.push(picture_buffer_id); |
709 TryOutputSurface(); | 710 TryOutputSurface(); |
710 } | 711 } |
711 | 712 |
712 void VaapiVideoDecodeAccelerator::FlushTask() { | 713 void VaapiVideoDecodeAccelerator::FlushTask() { |
713 DCHECK(decoder_thread_proxy_->BelongsToCurrentThread()); | 714 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); |
714 DVLOG(1) << "Flush task"; | 715 DVLOG(1) << "Flush task"; |
715 | 716 |
716 // First flush all the pictures that haven't been outputted, notifying the | 717 // First flush all the pictures that haven't been outputted, notifying the |
717 // client to output them. | 718 // client to output them. |
718 bool res = decoder_->Flush(); | 719 bool res = decoder_->Flush(); |
719 RETURN_AND_NOTIFY_ON_FAILURE(res, "Failed flushing the decoder.", | 720 RETURN_AND_NOTIFY_ON_FAILURE(res, "Failed flushing the decoder.", |
720 PLATFORM_FAILURE, ); | 721 PLATFORM_FAILURE, ); |
721 | 722 |
722 // Put the decoder in idle state, ready to resume. | 723 // Put the decoder in idle state, ready to resume. |
723 decoder_->Reset(); | 724 decoder_->Reset(); |
724 | 725 |
725 message_loop_->PostTask(FROM_HERE, base::Bind( | 726 message_loop_->PostTask(FROM_HERE, base::Bind( |
726 &VaapiVideoDecodeAccelerator::FinishFlush, weak_this_)); | 727 &VaapiVideoDecodeAccelerator::FinishFlush, weak_this_)); |
727 } | 728 } |
728 | 729 |
729 void VaapiVideoDecodeAccelerator::Flush() { | 730 void VaapiVideoDecodeAccelerator::Flush() { |
730 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 731 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
731 DVLOG(1) << "Got flush request"; | 732 DVLOG(1) << "Got flush request"; |
732 | 733 |
733 base::AutoLock auto_lock(lock_); | 734 base::AutoLock auto_lock(lock_); |
734 state_ = kFlushing; | 735 state_ = kFlushing; |
735 // Queue a flush task after all existing decoding tasks to clean up. | 736 // Queue a flush task after all existing decoding tasks to clean up. |
736 decoder_thread_proxy_->PostTask(FROM_HERE, base::Bind( | 737 decoder_thread_task_runner_->PostTask( |
737 &VaapiVideoDecodeAccelerator::FlushTask, base::Unretained(this))); | 738 FROM_HERE, base::Bind(&VaapiVideoDecodeAccelerator::FlushTask, |
| 739 base::Unretained(this))); |
738 | 740 |
739 input_ready_.Signal(); | 741 input_ready_.Signal(); |
740 surfaces_available_.Signal(); | 742 surfaces_available_.Signal(); |
741 } | 743 } |
742 | 744 |
743 void VaapiVideoDecodeAccelerator::FinishFlush() { | 745 void VaapiVideoDecodeAccelerator::FinishFlush() { |
744 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 746 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
745 | 747 |
746 finish_flush_pending_ = false; | 748 finish_flush_pending_ = false; |
747 | 749 |
(...skipping 12 matching lines...) Expand all Loading... |
760 | 762 |
761 state_ = kIdle; | 763 state_ = kIdle; |
762 | 764 |
763 message_loop_->PostTask(FROM_HERE, base::Bind( | 765 message_loop_->PostTask(FROM_HERE, base::Bind( |
764 &Client::NotifyFlushDone, client_)); | 766 &Client::NotifyFlushDone, client_)); |
765 | 767 |
766 DVLOG(1) << "Flush finished"; | 768 DVLOG(1) << "Flush finished"; |
767 } | 769 } |
768 | 770 |
769 void VaapiVideoDecodeAccelerator::ResetTask() { | 771 void VaapiVideoDecodeAccelerator::ResetTask() { |
770 DCHECK(decoder_thread_proxy_->BelongsToCurrentThread()); | 772 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); |
771 DVLOG(1) << "ResetTask"; | 773 DVLOG(1) << "ResetTask"; |
772 | 774 |
773 // All the decoding tasks from before the reset request from client are done | 775 // All the decoding tasks from before the reset request from client are done |
774 // by now, as this task was scheduled after them and client is expected not | 776 // by now, as this task was scheduled after them and client is expected not |
775 // to call Decode() after Reset() and before NotifyResetDone. | 777 // to call Decode() after Reset() and before NotifyResetDone. |
776 decoder_->Reset(); | 778 decoder_->Reset(); |
777 | 779 |
778 base::AutoLock auto_lock(lock_); | 780 base::AutoLock auto_lock(lock_); |
779 | 781 |
780 // Return current input buffer, if present. | 782 // Return current input buffer, if present. |
(...skipping 15 matching lines...) Expand all Loading... |
796 finish_flush_pending_ = false; | 798 finish_flush_pending_ = false; |
797 | 799 |
798 // Drop all remaining input buffers, if present. | 800 // Drop all remaining input buffers, if present. |
799 while (!input_buffers_.empty()) { | 801 while (!input_buffers_.empty()) { |
800 message_loop_->PostTask(FROM_HERE, base::Bind( | 802 message_loop_->PostTask(FROM_HERE, base::Bind( |
801 &Client::NotifyEndOfBitstreamBuffer, client_, | 803 &Client::NotifyEndOfBitstreamBuffer, client_, |
802 input_buffers_.front()->id)); | 804 input_buffers_.front()->id)); |
803 input_buffers_.pop(); | 805 input_buffers_.pop(); |
804 } | 806 } |
805 | 807 |
806 decoder_thread_proxy_->PostTask(FROM_HERE, base::Bind( | 808 decoder_thread_task_runner_->PostTask( |
807 &VaapiVideoDecodeAccelerator::ResetTask, base::Unretained(this))); | 809 FROM_HERE, base::Bind(&VaapiVideoDecodeAccelerator::ResetTask, |
| 810 base::Unretained(this))); |
808 | 811 |
809 input_ready_.Signal(); | 812 input_ready_.Signal(); |
810 surfaces_available_.Signal(); | 813 surfaces_available_.Signal(); |
811 } | 814 } |
812 | 815 |
813 void VaapiVideoDecodeAccelerator::FinishReset() { | 816 void VaapiVideoDecodeAccelerator::FinishReset() { |
814 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 817 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
815 DVLOG(1) << "FinishReset"; | 818 DVLOG(1) << "FinishReset"; |
816 base::AutoLock auto_lock(lock_); | 819 base::AutoLock auto_lock(lock_); |
817 | 820 |
(...skipping 22 matching lines...) Expand all Loading... |
840 &Client::NotifyResetDone, client_)); | 843 &Client::NotifyResetDone, client_)); |
841 | 844 |
842 // The client might have given us new buffers via Decode() while we were | 845 // The client might have given us new buffers via Decode() while we were |
843 // resetting and might be waiting for our move, and not call Decode() anymore | 846 // resetting and might be waiting for our move, and not call Decode() anymore |
844 // until we return something. Post a DecodeTask() so that we won't | 847 // until we return something. Post a DecodeTask() so that we won't |
845 // sleep forever waiting for Decode() in that case. Having two of them | 848 // sleep forever waiting for Decode() in that case. Having two of them |
846 // in the pipe is harmless, the additional one will return as soon as it sees | 849 // in the pipe is harmless, the additional one will return as soon as it sees |
847 // that we are back in kDecoding state. | 850 // that we are back in kDecoding state. |
848 if (!input_buffers_.empty()) { | 851 if (!input_buffers_.empty()) { |
849 state_ = kDecoding; | 852 state_ = kDecoding; |
850 decoder_thread_proxy_->PostTask(FROM_HERE, base::Bind( | 853 decoder_thread_task_runner_->PostTask( |
851 &VaapiVideoDecodeAccelerator::DecodeTask, | 854 FROM_HERE, base::Bind(&VaapiVideoDecodeAccelerator::DecodeTask, |
852 base::Unretained(this))); | 855 base::Unretained(this))); |
853 } | 856 } |
854 | 857 |
855 DVLOG(1) << "Reset finished"; | 858 DVLOG(1) << "Reset finished"; |
856 } | 859 } |
857 | 860 |
858 void VaapiVideoDecodeAccelerator::Cleanup() { | 861 void VaapiVideoDecodeAccelerator::Cleanup() { |
859 DCHECK_EQ(message_loop_, base::MessageLoop::current()); | 862 DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
860 | 863 |
861 base::AutoLock auto_lock(lock_); | 864 base::AutoLock auto_lock(lock_); |
862 if (state_ == kUninitialized || state_ == kDestroying) | 865 if (state_ == kUninitialized || state_ == kDestroying) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 | 925 |
923 pending_output_cbs_.push( | 926 pending_output_cbs_.push( |
924 base::Bind(&VaapiVideoDecodeAccelerator::OutputPicture, weak_this_, | 927 base::Bind(&VaapiVideoDecodeAccelerator::OutputPicture, weak_this_, |
925 dec_surface->va_surface(), dec_surface->bitstream_id())); | 928 dec_surface->va_surface(), dec_surface->bitstream_id())); |
926 | 929 |
927 TryOutputSurface(); | 930 TryOutputSurface(); |
928 } | 931 } |
929 | 932 |
930 scoped_refptr<VaapiVideoDecodeAccelerator::VaapiDecodeSurface> | 933 scoped_refptr<VaapiVideoDecodeAccelerator::VaapiDecodeSurface> |
931 VaapiVideoDecodeAccelerator::CreateSurface() { | 934 VaapiVideoDecodeAccelerator::CreateSurface() { |
932 DCHECK(decoder_thread_proxy_->BelongsToCurrentThread()); | 935 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); |
933 base::AutoLock auto_lock(lock_); | 936 base::AutoLock auto_lock(lock_); |
934 | 937 |
935 if (available_va_surfaces_.empty()) | 938 if (available_va_surfaces_.empty()) |
936 return nullptr; | 939 return nullptr; |
937 | 940 |
938 DCHECK(!awaiting_va_surfaces_recycle_); | 941 DCHECK(!awaiting_va_surfaces_recycle_); |
939 scoped_refptr<VASurface> va_surface( | 942 scoped_refptr<VASurface> va_surface( |
940 new VASurface(available_va_surfaces_.front(), requested_pic_size_, | 943 new VASurface(available_va_surfaces_.front(), requested_pic_size_, |
941 va_surface_release_cb_)); | 944 va_surface_release_cb_)); |
942 available_va_surfaces_.pop_front(); | 945 available_va_surfaces_.pop_front(); |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1509 return vaapi_pic->dec_surface(); | 1512 return vaapi_pic->dec_surface(); |
1510 } | 1513 } |
1511 | 1514 |
1512 // static | 1515 // static |
1513 media::VideoDecodeAccelerator::SupportedProfiles | 1516 media::VideoDecodeAccelerator::SupportedProfiles |
1514 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { | 1517 VaapiVideoDecodeAccelerator::GetSupportedProfiles() { |
1515 return VaapiWrapper::GetSupportedDecodeProfiles(); | 1518 return VaapiWrapper::GetSupportedDecodeProfiles(); |
1516 } | 1519 } |
1517 | 1520 |
1518 } // namespace content | 1521 } // namespace content |
OLD | NEW |