| 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 base::ResetAndReturn(&decode_cb_).Run(kOk); |
| 361 } | 361 } |
| 362 | 362 |
| 363 bool VpxVideoDecoder::VpxDecode(const scoped_refptr<DecoderBuffer>& buffer, | 363 bool VpxVideoDecoder::VpxDecode(const scoped_refptr<DecoderBuffer>& buffer, |
| 364 scoped_refptr<VideoFrame>* video_frame) { | 364 scoped_refptr<VideoFrame>* video_frame) { |
| 365 DCHECK(video_frame); | 365 DCHECK(video_frame); |
| 366 DCHECK(!buffer->end_of_stream()); | 366 DCHECK(!buffer->end_of_stream()); |
| 367 | 367 |
| 368 // Pass |buffer| to libvpx. | 368 // Pass |buffer| to libvpx. |
| 369 int64 timestamp = buffer->timestamp().InMicroseconds(); | 369 int64 timestamp = buffer->timestamp().InMicroseconds(); |
| 370 void* user_priv = reinterpret_cast<void*>(×tamp); | 370 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()); | 502 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); |
| 503 return; | 503 return; |
| 504 } | 504 } |
| 505 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], | 505 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], |
| 506 vpx_image->stride[VPX_PLANE_Y], | 506 vpx_image->stride[VPX_PLANE_Y], |
| 507 vpx_image->d_h, | 507 vpx_image->d_h, |
| 508 video_frame->get()); | 508 video_frame->get()); |
| 509 } | 509 } |
| 510 | 510 |
| 511 } // namespace media | 511 } // namespace media |
| OLD | NEW |