| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 decode_threads = std::max(decode_threads, 0); | 53 decode_threads = std::max(decode_threads, 0); |
| 54 decode_threads = std::min(decode_threads, kMaxDecodeThreads); | 54 decode_threads = std::min(decode_threads, kMaxDecodeThreads); |
| 55 return decode_threads; | 55 return decode_threads; |
| 56 } | 56 } |
| 57 | 57 |
| 58 VpxVideoDecoder::VpxVideoDecoder( | 58 VpxVideoDecoder::VpxVideoDecoder( |
| 59 const scoped_refptr<base::MessageLoopProxy>& message_loop) | 59 const scoped_refptr<base::MessageLoopProxy>& message_loop) |
| 60 : message_loop_(message_loop), | 60 : message_loop_(message_loop), |
| 61 weak_factory_(this), | 61 weak_factory_(this), |
| 62 state_(kUninitialized), | 62 state_(kUninitialized), |
| 63 demuxer_stream_(NULL), |
| 63 vpx_codec_(NULL) { | 64 vpx_codec_(NULL) { |
| 64 } | 65 } |
| 65 | 66 |
| 66 VpxVideoDecoder::~VpxVideoDecoder() { | 67 VpxVideoDecoder::~VpxVideoDecoder() { |
| 67 DCHECK_EQ(kUninitialized, state_); | 68 DCHECK_EQ(kUninitialized, state_); |
| 68 CloseDecoder(); | 69 CloseDecoder(); |
| 69 } | 70 } |
| 70 | 71 |
| 71 void VpxVideoDecoder::Initialize( | 72 void VpxVideoDecoder::Initialize( |
| 72 const scoped_refptr<DemuxerStream>& stream, | 73 DemuxerStream* stream, |
| 73 const PipelineStatusCB& status_cb, | 74 const PipelineStatusCB& status_cb, |
| 74 const StatisticsCB& statistics_cb) { | 75 const StatisticsCB& statistics_cb) { |
| 75 DCHECK(message_loop_->BelongsToCurrentThread()); | 76 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 76 DCHECK(!demuxer_stream_) << "Already initialized."; | 77 DCHECK(!demuxer_stream_) << "Already initialized."; |
| 77 weak_this_ = weak_factory_.GetWeakPtr(); | 78 weak_this_ = weak_factory_.GetWeakPtr(); |
| 78 | 79 |
| 79 if (!stream) { | 80 if (!stream) { |
| 80 status_cb.Run(PIPELINE_ERROR_DECODE); | 81 status_cb.Run(PIPELINE_ERROR_DECODE); |
| 81 return; | 82 return; |
| 82 } | 83 } |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 vpx_image->stride[VPX_PLANE_U], | 335 vpx_image->stride[VPX_PLANE_U], |
| 335 vpx_image->d_h / 2, | 336 vpx_image->d_h / 2, |
| 336 *video_frame); | 337 *video_frame); |
| 337 CopyVPlane(vpx_image->planes[VPX_PLANE_V], | 338 CopyVPlane(vpx_image->planes[VPX_PLANE_V], |
| 338 vpx_image->stride[VPX_PLANE_V], | 339 vpx_image->stride[VPX_PLANE_V], |
| 339 vpx_image->d_h / 2, | 340 vpx_image->d_h / 2, |
| 340 *video_frame); | 341 *video_frame); |
| 341 } | 342 } |
| 342 | 343 |
| 343 } // namespace media | 344 } // namespace media |
| OLD | NEW |