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

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: Call reset and stop callbacks after releasing |lock_| 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..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) {

Powered by Google App Engine
This is Rietveld 408576698