| 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/clients/mojo_audio_decoder.h" | 5 #include "media/mojo/clients/mojo_audio_decoder.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 DCHECK(task_runner_->BelongsToCurrentThread()); | 134 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 135 | 135 |
| 136 remote_decoder_.Bind(std::move(remote_decoder_info_)); | 136 remote_decoder_.Bind(std::move(remote_decoder_info_)); |
| 137 | 137 |
| 138 // Using base::Unretained(this) is safe because |this| owns |remote_decoder_|, | 138 // Using base::Unretained(this) is safe because |this| owns |remote_decoder_|, |
| 139 // and the error handler can't be invoked once |remote_decoder_| is destroyed. | 139 // and the error handler can't be invoked once |remote_decoder_| is destroyed. |
| 140 remote_decoder_.set_connection_error_handler( | 140 remote_decoder_.set_connection_error_handler( |
| 141 base::Bind(&MojoAudioDecoder::OnConnectionError, base::Unretained(this))); | 141 base::Bind(&MojoAudioDecoder::OnConnectionError, base::Unretained(this))); |
| 142 | 142 |
| 143 mojom::AudioDecoderClientAssociatedPtrInfo client_ptr_info; | 143 mojom::AudioDecoderClientAssociatedPtrInfo client_ptr_info; |
| 144 client_binding_.Bind(&client_ptr_info, remote_decoder_.associated_group()); | 144 client_binding_.Bind(&client_ptr_info); |
| 145 | 145 |
| 146 remote_decoder_->Construct(std::move(client_ptr_info)); | 146 remote_decoder_->Construct(std::move(client_ptr_info)); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void MojoAudioDecoder::OnBufferDecoded(mojom::AudioBufferPtr buffer) { | 149 void MojoAudioDecoder::OnBufferDecoded(mojom::AudioBufferPtr buffer) { |
| 150 DVLOG(1) << __func__; | 150 DVLOG(1) << __func__; |
| 151 DCHECK(task_runner_->BelongsToCurrentThread()); | 151 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 152 | 152 |
| 153 output_cb_.Run(buffer.To<scoped_refptr<AudioBuffer>>()); | 153 output_cb_.Run(buffer.To<scoped_refptr<AudioBuffer>>()); |
| 154 } | 154 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 DCHECK(task_runner_->BelongsToCurrentThread()); | 200 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 201 | 201 |
| 202 // For pending decodes OnDecodeStatus() should arrive before OnResetDone(). | 202 // For pending decodes OnDecodeStatus() should arrive before OnResetDone(). |
| 203 DCHECK(decode_cb_.is_null()); | 203 DCHECK(decode_cb_.is_null()); |
| 204 | 204 |
| 205 DCHECK(!reset_cb_.is_null()); | 205 DCHECK(!reset_cb_.is_null()); |
| 206 base::ResetAndReturn(&reset_cb_).Run(); | 206 base::ResetAndReturn(&reset_cb_).Run(); |
| 207 } | 207 } |
| 208 | 208 |
| 209 } // namespace media | 209 } // namespace media |
| OLD | NEW |