| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/common/gpu/media/android_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/android_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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 surface_texture_ = strategy_->CreateSurfaceTexture(); | 131 surface_texture_ = strategy_->CreateSurfaceTexture(); |
| 132 | 132 |
| 133 if (!ConfigureMediaCodec()) { | 133 if (!ConfigureMediaCodec()) { |
| 134 LOG(ERROR) << "Failed to create MediaCodec instance."; | 134 LOG(ERROR) << "Failed to create MediaCodec instance."; |
| 135 return false; | 135 return false; |
| 136 } | 136 } |
| 137 | 137 |
| 138 return true; | 138 return true; |
| 139 } | 139 } |
| 140 | 140 |
| 141 void AndroidVideoDecodeAccelerator::SetCdm(int /* cdm_id */) { |
| 142 // TODO(xhwang): Implement CDM setting here. |
| 143 NOTIMPLEMENTED(); |
| 144 NotifyCdmAttached(false); |
| 145 } |
| 146 |
| 141 void AndroidVideoDecodeAccelerator::DoIOTask() { | 147 void AndroidVideoDecodeAccelerator::DoIOTask() { |
| 142 DCHECK(thread_checker_.CalledOnValidThread()); | 148 DCHECK(thread_checker_.CalledOnValidThread()); |
| 143 TRACE_EVENT0("media", "AVDA::DoIOTask"); | 149 TRACE_EVENT0("media", "AVDA::DoIOTask"); |
| 144 if (state_ == ERROR) { | 150 if (state_ == ERROR) { |
| 145 return; | 151 return; |
| 146 } | 152 } |
| 147 | 153 |
| 148 QueueInput(); | 154 QueueInput(); |
| 149 while (DequeueOutput()) | 155 while (DequeueOutput()) |
| 150 ; | 156 ; |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 | 582 |
| 577 void AndroidVideoDecodeAccelerator::PostError( | 583 void AndroidVideoDecodeAccelerator::PostError( |
| 578 const ::tracked_objects::Location& from_here, | 584 const ::tracked_objects::Location& from_here, |
| 579 media::VideoDecodeAccelerator::Error error) { | 585 media::VideoDecodeAccelerator::Error error) { |
| 580 base::MessageLoop::current()->PostTask( | 586 base::MessageLoop::current()->PostTask( |
| 581 from_here, base::Bind(&AndroidVideoDecodeAccelerator::NotifyError, | 587 from_here, base::Bind(&AndroidVideoDecodeAccelerator::NotifyError, |
| 582 weak_this_factory_.GetWeakPtr(), error)); | 588 weak_this_factory_.GetWeakPtr(), error)); |
| 583 state_ = ERROR; | 589 state_ = ERROR; |
| 584 } | 590 } |
| 585 | 591 |
| 592 void AndroidVideoDecodeAccelerator::NotifyCdmAttached(bool success) { |
| 593 client_->NotifyCdmAttached(success); |
| 594 } |
| 595 |
| 586 void AndroidVideoDecodeAccelerator::NotifyPictureReady( | 596 void AndroidVideoDecodeAccelerator::NotifyPictureReady( |
| 587 const media::Picture& picture) { | 597 const media::Picture& picture) { |
| 588 client_->PictureReady(picture); | 598 client_->PictureReady(picture); |
| 589 } | 599 } |
| 590 | 600 |
| 591 void AndroidVideoDecodeAccelerator::NotifyEndOfBitstreamBuffer( | 601 void AndroidVideoDecodeAccelerator::NotifyEndOfBitstreamBuffer( |
| 592 int input_buffer_id) { | 602 int input_buffer_id) { |
| 593 client_->NotifyEndOfBitstreamBuffer(input_buffer_id); | 603 client_->NotifyEndOfBitstreamBuffer(input_buffer_id); |
| 594 } | 604 } |
| 595 | 605 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 // software fallback for H264 on Android anyway. | 649 // software fallback for H264 on Android anyway. |
| 640 profile.max_resolution.SetSize(3840, 2160); | 650 profile.max_resolution.SetSize(3840, 2160); |
| 641 profiles.push_back(profile); | 651 profiles.push_back(profile); |
| 642 } | 652 } |
| 643 #endif | 653 #endif |
| 644 | 654 |
| 645 return profiles; | 655 return profiles; |
| 646 } | 656 } |
| 647 | 657 |
| 648 } // namespace content | 658 } // namespace content |
| OLD | NEW |