OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_decryptor.h" | 5 #include "media/mojo/services/mojo_decryptor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 if (!new_audio_key_cb_.is_null()) | 109 if (!new_audio_key_cb_.is_null()) |
110 new_audio_key_cb_.Run(); | 110 new_audio_key_cb_.Run(); |
111 | 111 |
112 if (!new_video_key_cb_.is_null()) | 112 if (!new_video_key_cb_.is_null()) |
113 new_video_key_cb_.Run(); | 113 new_video_key_cb_.Run(); |
114 } | 114 } |
115 | 115 |
116 void MojoDecryptor::OnBufferDecrypted(const DecryptCB& decrypt_cb, | 116 void MojoDecryptor::OnBufferDecrypted(const DecryptCB& decrypt_cb, |
117 interfaces::Decryptor::Status status, | 117 interfaces::Decryptor::Status status, |
118 interfaces::DecoderBufferPtr buffer) { | 118 interfaces::DecoderBufferPtr buffer) { |
119 DVLOG_IF(1, status != interfaces::Decryptor::STATUS_SUCCESS) | 119 DVLOG_IF(1, status != interfaces::Decryptor::Status::SUCCESS) |
120 << __FUNCTION__ << "(" << status << ")"; | 120 << __FUNCTION__ << "(" << status << ")"; |
121 DVLOG_IF(3, status == interfaces::Decryptor::STATUS_SUCCESS) << __FUNCTION__; | 121 DVLOG_IF(3, status == interfaces::Decryptor::Status::SUCCESS) << __FUNCTION__; |
122 | 122 |
123 if (buffer.is_null()) { | 123 if (buffer.is_null()) { |
124 decrypt_cb.Run(static_cast<Decryptor::Status>(status), nullptr); | 124 decrypt_cb.Run(static_cast<Decryptor::Status>(status), nullptr); |
125 return; | 125 return; |
126 } | 126 } |
127 | 127 |
128 decrypt_cb.Run(static_cast<Decryptor::Status>(status), | 128 decrypt_cb.Run(static_cast<Decryptor::Status>(status), |
129 ReadDecoderBuffer(std::move(buffer))); | 129 ReadDecoderBuffer(std::move(buffer))); |
130 } | 130 } |
131 | 131 |
132 void MojoDecryptor::OnAudioDecoded( | 132 void MojoDecryptor::OnAudioDecoded( |
133 const AudioDecodeCB& audio_decode_cb, | 133 const AudioDecodeCB& audio_decode_cb, |
134 interfaces::Decryptor::Status status, | 134 interfaces::Decryptor::Status status, |
135 mojo::Array<interfaces::AudioBufferPtr> audio_buffers) { | 135 mojo::Array<interfaces::AudioBufferPtr> audio_buffers) { |
136 DVLOG_IF(1, status != interfaces::Decryptor::STATUS_SUCCESS) | 136 DVLOG_IF(1, status != interfaces::Decryptor::Status::SUCCESS) |
137 << __FUNCTION__ << "(" << status << ")"; | 137 << __FUNCTION__ << "(" << status << ")"; |
138 DVLOG_IF(3, status == interfaces::Decryptor::STATUS_SUCCESS) << __FUNCTION__; | 138 DVLOG_IF(3, status == interfaces::Decryptor::Status::SUCCESS) << __FUNCTION__; |
139 | 139 |
140 Decryptor::AudioFrames audio_frames; | 140 Decryptor::AudioFrames audio_frames; |
141 for (size_t i = 0; i < audio_buffers.size(); ++i) | 141 for (size_t i = 0; i < audio_buffers.size(); ++i) |
142 audio_frames.push_back(audio_buffers[i].To<scoped_refptr<AudioBuffer>>()); | 142 audio_frames.push_back(audio_buffers[i].To<scoped_refptr<AudioBuffer>>()); |
143 | 143 |
144 audio_decode_cb.Run(static_cast<Decryptor::Status>(status), audio_frames); | 144 audio_decode_cb.Run(static_cast<Decryptor::Status>(status), audio_frames); |
145 } | 145 } |
146 | 146 |
147 void MojoDecryptor::OnVideoDecoded(const VideoDecodeCB& video_decode_cb, | 147 void MojoDecryptor::OnVideoDecoded(const VideoDecodeCB& video_decode_cb, |
148 interfaces::Decryptor::Status status, | 148 interfaces::Decryptor::Status status, |
149 interfaces::VideoFramePtr video_frame) { | 149 interfaces::VideoFramePtr video_frame) { |
150 DVLOG_IF(1, status != interfaces::Decryptor::STATUS_SUCCESS) | 150 DVLOG_IF(1, status != interfaces::Decryptor::Status::SUCCESS) |
151 << __FUNCTION__ << "(" << status << ")"; | 151 << __FUNCTION__ << "(" << status << ")"; |
152 DVLOG_IF(3, status == interfaces::Decryptor::STATUS_SUCCESS) << __FUNCTION__; | 152 DVLOG_IF(3, status == interfaces::Decryptor::Status::SUCCESS) << __FUNCTION__; |
153 if (video_frame.is_null()) { | 153 if (video_frame.is_null()) { |
154 video_decode_cb.Run(static_cast<Decryptor::Status>(status), nullptr); | 154 video_decode_cb.Run(static_cast<Decryptor::Status>(status), nullptr); |
155 return; | 155 return; |
156 } | 156 } |
157 | 157 |
158 scoped_refptr<VideoFrame> frame(video_frame.To<scoped_refptr<VideoFrame>>()); | 158 scoped_refptr<VideoFrame> frame(video_frame.To<scoped_refptr<VideoFrame>>()); |
159 video_decode_cb.Run(static_cast<Decryptor::Status>(status), frame); | 159 video_decode_cb.Run(static_cast<Decryptor::Status>(status), frame); |
160 } | 160 } |
161 | 161 |
162 void MojoDecryptor::CreateDataPipes() { | 162 void MojoDecryptor::CreateDataPipes() { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 uint32_t num_bytes = base::checked_cast<uint32_t>(media_buffer->data_size()); | 217 uint32_t num_bytes = base::checked_cast<uint32_t>(media_buffer->data_size()); |
218 DCHECK_GT(num_bytes, 0u); | 218 DCHECK_GT(num_bytes, 0u); |
219 CHECK_EQ(ReadDataRaw(consumer_handle_.get(), media_buffer->writable_data(), | 219 CHECK_EQ(ReadDataRaw(consumer_handle_.get(), media_buffer->writable_data(), |
220 &num_bytes, MOJO_READ_DATA_FLAG_ALL_OR_NONE), | 220 &num_bytes, MOJO_READ_DATA_FLAG_ALL_OR_NONE), |
221 MOJO_RESULT_OK); | 221 MOJO_RESULT_OK); |
222 CHECK_EQ(num_bytes, static_cast<uint32_t>(media_buffer->data_size())); | 222 CHECK_EQ(num_bytes, static_cast<uint32_t>(media_buffer->data_size())); |
223 return media_buffer; | 223 return media_buffer; |
224 } | 224 } |
225 | 225 |
226 } // namespace media | 226 } // namespace media |
OLD | NEW |