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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 state_ = kError; | 227 state_ = kError; |
228 decode_cb_bound.Run(kDecodeError); | 228 decode_cb_bound.Run(kDecodeError); |
229 return; | 229 return; |
230 } | 230 } |
231 // Repeat to flush the decoder after receiving EOS buffer. | 231 // Repeat to flush the decoder after receiving EOS buffer. |
232 } while (buffer->end_of_stream() && has_produced_frame); | 232 } while (buffer->end_of_stream() && has_produced_frame); |
233 | 233 |
234 if (buffer->end_of_stream()) | 234 if (buffer->end_of_stream()) |
235 state_ = kDecodeFinished; | 235 state_ = kDecodeFinished; |
236 | 236 |
| 237 // VideoDecoderShim expects that |decode_cb| is called only after |
| 238 // |output_cb_|. |
237 decode_cb_bound.Run(kOk); | 239 decode_cb_bound.Run(kOk); |
238 } | 240 } |
239 | 241 |
240 void FFmpegVideoDecoder::Reset(const base::Closure& closure) { | 242 void FFmpegVideoDecoder::Reset(const base::Closure& closure) { |
241 DCHECK(task_runner_->BelongsToCurrentThread()); | 243 DCHECK(task_runner_->BelongsToCurrentThread()); |
242 | 244 |
243 avcodec_flush_buffers(codec_context_.get()); | 245 avcodec_flush_buffers(codec_context_.get()); |
244 state_ = kNormal; | 246 state_ = kNormal; |
245 task_runner_->PostTask(FROM_HERE, closure); | 247 task_runner_->PostTask(FROM_HERE, closure); |
246 } | 248 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { | 347 if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { |
346 ReleaseFFmpegResources(); | 348 ReleaseFFmpegResources(); |
347 return false; | 349 return false; |
348 } | 350 } |
349 | 351 |
350 av_frame_.reset(av_frame_alloc()); | 352 av_frame_.reset(av_frame_alloc()); |
351 return true; | 353 return true; |
352 } | 354 } |
353 | 355 |
354 } // namespace media | 356 } // namespace media |
OLD | NEW |