Chromium Code Reviews| Index: media/filters/ffmpeg_audio_decoder.cc |
| diff --git a/media/filters/ffmpeg_audio_decoder.cc b/media/filters/ffmpeg_audio_decoder.cc |
| index a0e5889eff11aca7e6c84c6bdbf26080ca2fd8c0..1267761747ec7df6689349bde9f04ee625ecd39b 100644 |
| --- a/media/filters/ffmpeg_audio_decoder.cc |
| +++ b/media/filters/ffmpeg_audio_decoder.cc |
| @@ -155,12 +155,21 @@ void FFmpegAudioDecoder::Reset(const base::Closure& closure) { |
| reset_cb.Run(); |
| } |
| -FFmpegAudioDecoder::~FFmpegAudioDecoder() { |
| - // TODO(scherkus): should we require Stop() to be called? this might end up |
| - // getting called on a random thread due to refcounting. |
| +void FFmpegAudioDecoder::Stop(const base::Closure& closure) { |
| + DCHECK(task_runner_->BelongsToCurrentThread()); |
| + base::Closure stop_cb = BindToCurrentLoop(closure); |
| + |
| + ResetTimestampState(); |
| + queued_audio_.clear(); |
| ReleaseFFmpegResources(); |
| + |
| + // TODO(rileya): Properly handle the case in which we have a pending |
|
DaleCurtis
2014/01/09 01:24:49
Hmm, I suspect you may need to handle that in this
|
| + // |read_cb_| when Stop() or Reset()-ing. |
| + stop_cb.Run(); |
| } |
| +FFmpegAudioDecoder::~FFmpegAudioDecoder() {} |
| + |
| int FFmpegAudioDecoder::GetAudioBuffer(AVCodecContext* codec, |
| AVFrame* frame, |
| int flags) { |