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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 mojo::ScopedDataPipeConsumerHandle remote_consumer_handle; | 168 mojo::ScopedDataPipeConsumerHandle remote_consumer_handle; |
169 mojo_decoder_buffer_writer_ = MojoDecoderBufferWriter::Create( | 169 mojo_decoder_buffer_writer_ = MojoDecoderBufferWriter::Create( |
170 DemuxerStream::AUDIO, &remote_consumer_handle); | 170 DemuxerStream::AUDIO, &remote_consumer_handle); |
171 // Pass consumer end to |remote_decoder_|. | 171 // Pass consumer end to |remote_decoder_|. |
172 remote_decoder_->SetDataSource(std::move(remote_consumer_handle)); | 172 remote_decoder_->SetDataSource(std::move(remote_consumer_handle)); |
173 } | 173 } |
174 | 174 |
175 base::ResetAndReturn(&init_cb_).Run(success); | 175 base::ResetAndReturn(&init_cb_).Run(success); |
176 } | 176 } |
177 | 177 |
178 void MojoAudioDecoder::OnDecodeStatus(mojom::DecodeStatus status) { | 178 void MojoAudioDecoder::OnDecodeStatus(DecodeStatus status) { |
179 DVLOG(1) << __FUNCTION__ << ": status:" << status; | 179 DVLOG(1) << __FUNCTION__ << ": status:" << status; |
180 DCHECK(task_runner_->BelongsToCurrentThread()); | 180 DCHECK(task_runner_->BelongsToCurrentThread()); |
181 | 181 |
182 DCHECK(!decode_cb_.is_null()); | 182 DCHECK(!decode_cb_.is_null()); |
183 base::ResetAndReturn(&decode_cb_).Run(static_cast<DecodeStatus>(status)); | 183 base::ResetAndReturn(&decode_cb_).Run(status); |
184 } | 184 } |
185 | 185 |
186 void MojoAudioDecoder::OnResetDone() { | 186 void MojoAudioDecoder::OnResetDone() { |
187 DVLOG(1) << __FUNCTION__; | 187 DVLOG(1) << __FUNCTION__; |
188 DCHECK(task_runner_->BelongsToCurrentThread()); | 188 DCHECK(task_runner_->BelongsToCurrentThread()); |
189 | 189 |
190 // For pending decodes OnDecodeStatus() should arrive before OnResetDone(). | 190 // For pending decodes OnDecodeStatus() should arrive before OnResetDone(). |
191 DCHECK(decode_cb_.is_null()); | 191 DCHECK(decode_cb_.is_null()); |
192 | 192 |
193 DCHECK(!reset_cb_.is_null()); | 193 DCHECK(!reset_cb_.is_null()); |
194 base::ResetAndReturn(&reset_cb_).Run(); | 194 base::ResetAndReturn(&reset_cb_).Run(); |
195 } | 195 } |
196 | 196 |
197 } // namespace media | 197 } // namespace media |
OLD | NEW |