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_service.h" | 5 #include "media/mojo/services/mojo_audio_decoder_service.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/logging.h" | 9 #include "base/logging.h" |
10 #include "media/base/cdm_context.h" | 10 #include "media/base/cdm_context.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 if (success) { | 97 if (success) { |
98 cdm_ = cdm; | 98 cdm_ = cdm; |
99 callback.Run(success, decoder_->NeedsBitstreamConversion()); | 99 callback.Run(success, decoder_->NeedsBitstreamConversion()); |
100 } else { | 100 } else { |
101 // Do not call decoder_->NeedsBitstreamConversion() if init failed. | 101 // Do not call decoder_->NeedsBitstreamConversion() if init failed. |
102 callback.Run(false, false); | 102 callback.Run(false, false); |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 static interfaces::AudioDecoder::DecodeStatus ConvertDecodeStatus( | 106 static interfaces::AudioDecoder::DecodeStatus ConvertDecodeStatus( |
107 media::AudioDecoder::Status status) { | 107 media::DecodeStatus status) { |
108 switch (status) { | 108 switch (status) { |
109 case media::AudioDecoder::kOk: | 109 case media::DecodeStatus::OK: |
110 return interfaces::AudioDecoder::DecodeStatus::OK; | 110 return interfaces::AudioDecoder::DecodeStatus::OK; |
111 case media::AudioDecoder::kAborted: | 111 case media::DecodeStatus::ABORTED: |
112 return interfaces::AudioDecoder::DecodeStatus::ABORTED; | 112 return interfaces::AudioDecoder::DecodeStatus::ABORTED; |
113 case media::AudioDecoder::kDecodeError: | 113 case media::DecodeStatus::DECODE_ERROR: |
114 return interfaces::AudioDecoder::DecodeStatus::DECODE_ERROR; | 114 return interfaces::AudioDecoder::DecodeStatus::DECODE_ERROR; |
115 } | 115 } |
116 NOTREACHED(); | 116 NOTREACHED(); |
117 return interfaces::AudioDecoder::DecodeStatus::DECODE_ERROR; | 117 return interfaces::AudioDecoder::DecodeStatus::DECODE_ERROR; |
118 } | 118 } |
119 | 119 |
120 void MojoAudioDecoderService::OnDecodeStatus( | 120 void MojoAudioDecoderService::OnDecodeStatus(const DecodeCallback& callback, |
121 const DecodeCallback& callback, | 121 media::DecodeStatus status) { |
122 media::AudioDecoder::Status status) { | |
123 DVLOG(3) << __FUNCTION__ << " status:" << status; | 122 DVLOG(3) << __FUNCTION__ << " status:" << status; |
124 callback.Run(ConvertDecodeStatus(status)); | 123 callback.Run(ConvertDecodeStatus(status)); |
125 } | 124 } |
126 | 125 |
127 void MojoAudioDecoderService::OnResetDone(const ResetCallback& callback) { | 126 void MojoAudioDecoderService::OnResetDone(const ResetCallback& callback) { |
128 DVLOG(1) << __FUNCTION__; | 127 DVLOG(1) << __FUNCTION__; |
129 callback.Run(); | 128 callback.Run(); |
130 } | 129 } |
131 | 130 |
132 void MojoAudioDecoderService::OnAudioBufferReady( | 131 void MojoAudioDecoderService::OnAudioBufferReady( |
(...skipping 26 matching lines...) Expand all Loading... |
159 uint32_t bytes_read = bytes_to_read; | 158 uint32_t bytes_read = bytes_to_read; |
160 CHECK_EQ(ReadDataRaw(consumer_handle_.get(), media_buffer->writable_data(), | 159 CHECK_EQ(ReadDataRaw(consumer_handle_.get(), media_buffer->writable_data(), |
161 &bytes_read, MOJO_READ_DATA_FLAG_ALL_OR_NONE), | 160 &bytes_read, MOJO_READ_DATA_FLAG_ALL_OR_NONE), |
162 MOJO_RESULT_OK); | 161 MOJO_RESULT_OK); |
163 CHECK_EQ(bytes_to_read, bytes_read); | 162 CHECK_EQ(bytes_to_read, bytes_read); |
164 | 163 |
165 return media_buffer; | 164 return media_buffer; |
166 } | 165 } |
167 | 166 |
168 } // namespace media | 167 } // namespace media |
OLD | NEW |