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/clients/mojo_decryptor.h" | 5 #include "media/mojo/clients/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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 Decryptor::AudioFrames audio_frames; | 218 Decryptor::AudioFrames audio_frames; |
219 for (size_t i = 0; i < audio_buffers.size(); ++i) | 219 for (size_t i = 0; i < audio_buffers.size(); ++i) |
220 audio_frames.push_back(audio_buffers[i].To<scoped_refptr<AudioBuffer>>()); | 220 audio_frames.push_back(audio_buffers[i].To<scoped_refptr<AudioBuffer>>()); |
221 | 221 |
222 audio_decode_cb.Run(status, audio_frames); | 222 audio_decode_cb.Run(status, audio_frames); |
223 } | 223 } |
224 | 224 |
225 void MojoDecryptor::OnVideoDecoded(const VideoDecodeCB& video_decode_cb, | 225 void MojoDecryptor::OnVideoDecoded(const VideoDecodeCB& video_decode_cb, |
226 Status status, | 226 Status status, |
227 mojom::VideoFramePtr video_frame, | 227 const scoped_refptr<VideoFrame>& video_frame, |
228 mojom::FrameResourceReleaserPtr releaser) { | 228 mojom::FrameResourceReleaserPtr releaser) { |
229 DVLOG_IF(1, status != kSuccess) << __func__ << "(" << status << ")"; | 229 DVLOG_IF(1, status != kSuccess) << __func__ << "(" << status << ")"; |
230 DVLOG_IF(3, status == kSuccess) << __func__; | 230 DVLOG_IF(3, status == kSuccess) << __func__; |
231 DCHECK(thread_checker_.CalledOnValidThread()); | 231 DCHECK(thread_checker_.CalledOnValidThread()); |
232 | 232 |
233 if (video_frame.is_null()) { | |
234 video_decode_cb.Run(status, nullptr); | |
235 return; | |
236 } | |
237 | |
238 scoped_refptr<VideoFrame> frame(video_frame.To<scoped_refptr<VideoFrame>>()); | |
239 | |
240 // If using shared memory, ensure that |releaser| is closed when | 233 // If using shared memory, ensure that |releaser| is closed when |
241 // |frame| is destroyed. | 234 // |frame| is destroyed. |
242 if (releaser) { | 235 if (video_frame && releaser) { |
243 frame->AddDestructionObserver( | 236 video_frame->AddDestructionObserver( |
244 base::Bind(&ReleaseFrameResource, base::Passed(&releaser))); | 237 base::Bind(&ReleaseFrameResource, base::Passed(&releaser))); |
245 } | 238 } |
246 | 239 |
247 video_decode_cb.Run(status, frame); | 240 video_decode_cb.Run(status, video_frame); |
248 } | 241 } |
249 | 242 |
250 } // namespace media | 243 } // namespace media |
OLD | NEW |