Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(574)

Unified Diff: media/filters/ffmpeg_audio_decoder.cc

Issue 126793002: Add Stop() to AudioDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove blank lines Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..8de9f962a8f2d7d8c8a6940654667759259d31f9 100644
--- a/media/filters/ffmpeg_audio_decoder.cc
+++ b/media/filters/ffmpeg_audio_decoder.cc
@@ -155,12 +155,20 @@ 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);
+
+ avcodec_flush_buffers(codec_context_.get());
DaleCurtis 2014/01/08 00:30:54 What made you add this? We don't make a similar c
rileya (GONE FROM CHROMIUM) 2014/01/08 21:05:50 I'm not sure actually I think I saw it done in Res
+ ResetTimestampState();
+ queued_audio_.clear();
ReleaseFFmpegResources();
+
+ stop_cb.Run();
xhwang 2014/01/08 01:33:37 Here and in Reset(), what if we have |read_cb_| pe
rileya (GONE FROM CHROMIUM) 2014/01/08 21:05:50 I'd wondered about this, added a TODO.
}
+FFmpegAudioDecoder::~FFmpegAudioDecoder() {}
+
int FFmpegAudioDecoder::GetAudioBuffer(AVCodecContext* codec,
AVFrame* frame,
int flags) {

Powered by Google App Engine
This is Rietveld 408576698