| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "media/mojo/services/mojo_audio_decoder.h" | 5 #include "media/mojo/services/mojo_audio_decoder.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
| 12 | 12 |
| 13 namespace media { | 13 namespace media { |
| 14 | 14 |
| 15 MojoAudioDecoder::MojoAudioDecoder() { | 15 MojoAudioDecoder::MojoAudioDecoder( |
| 16 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 17 interfaces::AudioDecoderPtr remote_decoder) |
| 18 : task_runner_(task_runner), remote_decoder_(std::move(remote_decoder)) { |
| 16 DVLOG(1) << __FUNCTION__; | 19 DVLOG(1) << __FUNCTION__; |
| 17 } | 20 } |
| 18 | 21 |
| 19 MojoAudioDecoder::~MojoAudioDecoder() { | 22 MojoAudioDecoder::~MojoAudioDecoder() { |
| 20 DVLOG(1) << __FUNCTION__; | 23 DVLOG(1) << __FUNCTION__; |
| 21 } | 24 } |
| 22 | 25 |
| 23 std::string MojoAudioDecoder::GetDisplayName() const { | 26 std::string MojoAudioDecoder::GetDisplayName() const { |
| 24 return "MojoAudioDecoder"; | 27 return "MojoAudioDecoder"; |
| 25 } | 28 } |
| 26 | 29 |
| 27 void MojoAudioDecoder::Initialize(const AudioDecoderConfig& config, | 30 void MojoAudioDecoder::Initialize(const AudioDecoderConfig& config, |
| 28 CdmContext* cdm_context, | 31 CdmContext* cdm_context, |
| 29 const InitCB& init_cb, | 32 const InitCB& init_cb, |
| 30 const OutputCB& output_cb) { | 33 const OutputCB& output_cb) { |
| 31 DVLOG(1) << __FUNCTION__; | 34 DVLOG(1) << __FUNCTION__; |
| 32 task_runner_ = base::ThreadTaskRunnerHandle::Get(); | 35 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 33 | 36 |
| 34 NOTIMPLEMENTED(); | 37 NOTIMPLEMENTED(); |
| 35 | 38 |
| 36 // Pretend to be able to decode anything. | 39 // Fail initialization while not implemented. |
| 37 task_runner_->PostTask(FROM_HERE, base::Bind(init_cb, true)); | 40 task_runner_->PostTask(FROM_HERE, base::Bind(init_cb, false)); |
| 38 } | 41 } |
| 39 | 42 |
| 40 void MojoAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, | 43 void MojoAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, |
| 41 const DecodeCB& decode_cb) { | 44 const DecodeCB& decode_cb) { |
| 42 DVLOG(3) << __FUNCTION__; | 45 DVLOG(3) << __FUNCTION__; |
| 46 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 47 |
| 43 NOTIMPLEMENTED(); | 48 NOTIMPLEMENTED(); |
| 44 | 49 |
| 45 // Actually we can't decode anything. | 50 // Actually we can't decode anything. |
| 46 task_runner_->PostTask(FROM_HERE, base::Bind(decode_cb, kDecodeError)); | 51 task_runner_->PostTask(FROM_HERE, base::Bind(decode_cb, kDecodeError)); |
| 47 } | 52 } |
| 48 | 53 |
| 49 void MojoAudioDecoder::Reset(const base::Closure& closure) { | 54 void MojoAudioDecoder::Reset(const base::Closure& closure) { |
| 50 DVLOG(2) << __FUNCTION__; | 55 DVLOG(2) << __FUNCTION__; |
| 56 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 57 |
| 51 NOTIMPLEMENTED(); | 58 NOTIMPLEMENTED(); |
| 52 } | 59 } |
| 53 | 60 |
| 54 bool MojoAudioDecoder::NeedsBitstreamConversion() const { | 61 bool MojoAudioDecoder::NeedsBitstreamConversion() const { |
| 55 DVLOG(1) << __FUNCTION__; | 62 DVLOG(1) << __FUNCTION__; |
| 63 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 64 |
| 56 NOTIMPLEMENTED(); | 65 NOTIMPLEMENTED(); |
| 57 return false; | 66 return false; |
| 58 } | 67 } |
| 59 | 68 |
| 60 } // namespace media | 69 } // namespace media |
| OLD | NEW |