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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 } | 202 } |
203 | 203 |
204 VpxVideoDecoder::VpxVideoDecoder( | 204 VpxVideoDecoder::VpxVideoDecoder( |
205 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) | 205 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) |
206 : task_runner_(task_runner), | 206 : task_runner_(task_runner), |
207 state_(kUninitialized), | 207 state_(kUninitialized), |
208 vpx_codec_(NULL), | 208 vpx_codec_(NULL), |
209 vpx_codec_alpha_(NULL) {} | 209 vpx_codec_alpha_(NULL) {} |
210 | 210 |
211 VpxVideoDecoder::~VpxVideoDecoder() { | 211 VpxVideoDecoder::~VpxVideoDecoder() { |
212 DCHECK_EQ(kUninitialized, state_); | 212 DCHECK(task_runner_->BelongsToCurrentThread()); |
213 state_ = kUninitialized; | |
scherkus (not reviewing)
2014/07/15 23:37:26
nit: not really needed
xhwang
2014/07/16 03:37:22
Done.
| |
213 CloseDecoder(); | 214 CloseDecoder(); |
214 } | 215 } |
215 | 216 |
216 void VpxVideoDecoder::Initialize(const VideoDecoderConfig& config, | 217 void VpxVideoDecoder::Initialize(const VideoDecoderConfig& config, |
217 bool low_delay, | 218 bool low_delay, |
218 const PipelineStatusCB& status_cb, | 219 const PipelineStatusCB& status_cb, |
219 const OutputCB& output_cb) { | 220 const OutputCB& output_cb) { |
220 DCHECK(task_runner_->BelongsToCurrentThread()); | 221 DCHECK(task_runner_->BelongsToCurrentThread()); |
221 DCHECK(config.IsValidConfig()); | 222 DCHECK(config.IsValidConfig()); |
222 DCHECK(!config.is_encrypted()); | 223 DCHECK(!config.is_encrypted()); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 } | 332 } |
332 | 333 |
333 void VpxVideoDecoder::Reset(const base::Closure& closure) { | 334 void VpxVideoDecoder::Reset(const base::Closure& closure) { |
334 DCHECK(task_runner_->BelongsToCurrentThread()); | 335 DCHECK(task_runner_->BelongsToCurrentThread()); |
335 DCHECK(decode_cb_.is_null()); | 336 DCHECK(decode_cb_.is_null()); |
336 | 337 |
337 state_ = kNormal; | 338 state_ = kNormal; |
338 task_runner_->PostTask(FROM_HERE, closure); | 339 task_runner_->PostTask(FROM_HERE, closure); |
339 } | 340 } |
340 | 341 |
341 void VpxVideoDecoder::Stop() { | |
342 DCHECK(task_runner_->BelongsToCurrentThread()); | |
343 | |
344 state_ = kUninitialized; | |
345 } | |
346 | |
347 void VpxVideoDecoder::DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer) { | 342 void VpxVideoDecoder::DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer) { |
348 DCHECK(task_runner_->BelongsToCurrentThread()); | 343 DCHECK(task_runner_->BelongsToCurrentThread()); |
349 DCHECK_NE(state_, kUninitialized); | 344 DCHECK_NE(state_, kUninitialized); |
350 DCHECK_NE(state_, kDecodeFinished); | 345 DCHECK_NE(state_, kDecodeFinished); |
351 DCHECK_NE(state_, kError); | 346 DCHECK_NE(state_, kError); |
352 DCHECK(!decode_cb_.is_null()); | 347 DCHECK(!decode_cb_.is_null()); |
353 DCHECK(buffer); | 348 DCHECK(buffer); |
354 | 349 |
355 // Transition to kDecodeFinished on the first end of stream buffer. | 350 // Transition to kDecodeFinished on the first end of stream buffer. |
356 if (state_ == kNormal && buffer->end_of_stream()) { | 351 if (state_ == kNormal && buffer->end_of_stream()) { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
507 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()); |
508 return; | 503 return; |
509 } | 504 } |
510 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], | 505 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], |
511 vpx_image->stride[VPX_PLANE_Y], | 506 vpx_image->stride[VPX_PLANE_Y], |
512 vpx_image->d_h, | 507 vpx_image->d_h, |
513 video_frame->get()); | 508 video_frame->get()); |
514 } | 509 } |
515 | 510 |
516 } // namespace media | 511 } // namespace media |
OLD | NEW |