OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/filters/vpx_video_decoder.h" | 5 #include "media/filters/vpx_video_decoder.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 return; | 347 return; |
348 } | 348 } |
349 | 349 |
350 scoped_refptr<VideoFrame> video_frame; | 350 scoped_refptr<VideoFrame> video_frame; |
351 if (!VpxDecode(buffer, &video_frame)) { | 351 if (!VpxDecode(buffer, &video_frame)) { |
352 state_ = kError; | 352 state_ = kError; |
353 base::ResetAndReturn(&decode_cb_).Run(kDecodeError); | 353 base::ResetAndReturn(&decode_cb_).Run(kDecodeError); |
354 return; | 354 return; |
355 } | 355 } |
356 | 356 |
357 base::ResetAndReturn(&decode_cb_).Run(kOk); | |
358 | |
359 if (video_frame.get()) | 357 if (video_frame.get()) |
360 output_cb_.Run(video_frame); | 358 output_cb_.Run(video_frame); |
| 359 |
| 360 // VideoDecoderShim expects that |decode_cb| is called only after |
| 361 // |output_cb_|. |
| 362 base::ResetAndReturn(&decode_cb_).Run(kOk); |
361 } | 363 } |
362 | 364 |
363 bool VpxVideoDecoder::VpxDecode(const scoped_refptr<DecoderBuffer>& buffer, | 365 bool VpxVideoDecoder::VpxDecode(const scoped_refptr<DecoderBuffer>& buffer, |
364 scoped_refptr<VideoFrame>* video_frame) { | 366 scoped_refptr<VideoFrame>* video_frame) { |
365 DCHECK(video_frame); | 367 DCHECK(video_frame); |
366 DCHECK(!buffer->end_of_stream()); | 368 DCHECK(!buffer->end_of_stream()); |
367 | 369 |
368 // Pass |buffer| to libvpx. | 370 // Pass |buffer| to libvpx. |
369 int64 timestamp = buffer->timestamp().InMicroseconds(); | 371 int64 timestamp = buffer->timestamp().InMicroseconds(); |
370 void* user_priv = reinterpret_cast<void*>(×tamp); | 372 void* user_priv = reinterpret_cast<void*>(×tamp); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); | 504 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); |
503 return; | 505 return; |
504 } | 506 } |
505 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], | 507 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], |
506 vpx_image->stride[VPX_PLANE_Y], | 508 vpx_image->stride[VPX_PLANE_Y], |
507 vpx_image->d_h, | 509 vpx_image->d_h, |
508 video_frame->get()); | 510 video_frame->get()); |
509 } | 511 } |
510 | 512 |
511 } // namespace media | 513 } // namespace media |
OLD | NEW |