| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 decode_threads = std::max(decode_threads, 0); | 54 decode_threads = std::max(decode_threads, 0); |
| 55 decode_threads = std::min(decode_threads, kMaxDecodeThreads); | 55 decode_threads = std::min(decode_threads, kMaxDecodeThreads); |
| 56 return decode_threads; | 56 return decode_threads; |
| 57 } | 57 } |
| 58 | 58 |
| 59 VpxVideoDecoder::VpxVideoDecoder( | 59 VpxVideoDecoder::VpxVideoDecoder( |
| 60 const scoped_refptr<base::MessageLoopProxy>& message_loop) | 60 const scoped_refptr<base::MessageLoopProxy>& message_loop) |
| 61 : message_loop_(message_loop), | 61 : message_loop_(message_loop), |
| 62 weak_factory_(this), | 62 weak_factory_(this), |
| 63 state_(kUninitialized), | 63 state_(kUninitialized), |
| 64 demuxer_stream_(NULL), |
| 64 vpx_codec_(NULL), | 65 vpx_codec_(NULL), |
| 65 vpx_codec_alpha_(NULL) { | 66 vpx_codec_alpha_(NULL) { |
| 66 } | 67 } |
| 67 | 68 |
| 68 VpxVideoDecoder::~VpxVideoDecoder() { | 69 VpxVideoDecoder::~VpxVideoDecoder() { |
| 69 DCHECK_EQ(kUninitialized, state_); | 70 DCHECK_EQ(kUninitialized, state_); |
| 70 CloseDecoder(); | 71 CloseDecoder(); |
| 71 } | 72 } |
| 72 | 73 |
| 73 void VpxVideoDecoder::Initialize( | 74 void VpxVideoDecoder::Initialize( |
| 74 const scoped_refptr<DemuxerStream>& stream, | 75 DemuxerStream* stream, |
| 75 const PipelineStatusCB& status_cb, | 76 const PipelineStatusCB& status_cb, |
| 76 const StatisticsCB& statistics_cb) { | 77 const StatisticsCB& statistics_cb) { |
| 77 DCHECK(message_loop_->BelongsToCurrentThread()); | 78 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 78 DCHECK(!demuxer_stream_) << "Already initialized."; | 79 DCHECK(!demuxer_stream_) << "Already initialized."; |
| 79 weak_this_ = weak_factory_.GetWeakPtr(); | 80 weak_this_ = weak_factory_.GetWeakPtr(); |
| 80 | 81 |
| 81 if (!stream) { | 82 if (!stream) { |
| 82 status_cb.Run(PIPELINE_ERROR_DECODE); | 83 status_cb.Run(PIPELINE_ERROR_DECODE); |
| 83 return; | 84 return; |
| 84 } | 85 } |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 *video_frame); | 427 *video_frame); |
| 427 return; | 428 return; |
| 428 } | 429 } |
| 429 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], | 430 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], |
| 430 vpx_image->stride[VPX_PLANE_Y], | 431 vpx_image->stride[VPX_PLANE_Y], |
| 431 vpx_image->d_h, | 432 vpx_image->d_h, |
| 432 *video_frame); | 433 *video_frame); |
| 433 } | 434 } |
| 434 | 435 |
| 435 } // namespace media | 436 } // namespace media |
| OLD | NEW |