| 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/ffmpeg_video_decoder.h" | 5 #include "media/filters/ffmpeg_video_decoder.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 192 } |
| 193 | 193 |
| 194 void FFmpegVideoDecoder::Stop(const base::Closure& closure) { | 194 void FFmpegVideoDecoder::Stop(const base::Closure& closure) { |
| 195 DCHECK(task_runner_->BelongsToCurrentThread()); | 195 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 196 base::ScopedClosureRunner runner(BindToCurrentLoop(closure)); | 196 base::ScopedClosureRunner runner(BindToCurrentLoop(closure)); |
| 197 | 197 |
| 198 if (state_ == kUninitialized) | 198 if (state_ == kUninitialized) |
| 199 return; | 199 return; |
| 200 | 200 |
| 201 if (!decode_cb_.is_null()) { | 201 if (!decode_cb_.is_null()) { |
| 202 base::ResetAndReturn(&decode_cb_).Run(kOk, NULL); | 202 base::ResetAndReturn(&decode_cb_).Run(kAborted, NULL); |
| 203 // Reset is pending only when decode is pending. | 203 // Reset is pending only when decode is pending. |
| 204 if (!reset_cb_.is_null()) | 204 if (!reset_cb_.is_null()) |
| 205 base::ResetAndReturn(&reset_cb_).Run(); | 205 base::ResetAndReturn(&reset_cb_).Run(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 ReleaseFFmpegResources(); | 208 ReleaseFFmpegResources(); |
| 209 state_ = kUninitialized; | 209 state_ = kUninitialized; |
| 210 } | 210 } |
| 211 | 211 |
| 212 FFmpegVideoDecoder::~FFmpegVideoDecoder() { | 212 FFmpegVideoDecoder::~FFmpegVideoDecoder() { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { | 378 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { |
| 379 ReleaseFFmpegResources(); | 379 ReleaseFFmpegResources(); |
| 380 return false; | 380 return false; |
| 381 } | 381 } |
| 382 | 382 |
| 383 av_frame_.reset(av_frame_alloc()); | 383 av_frame_.reset(av_frame_alloc()); |
| 384 return true; | 384 return true; |
| 385 } | 385 } |
| 386 | 386 |
| 387 } // namespace media | 387 } // namespace media |
| OLD | NEW |