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

Side by Side Diff: media/filters/ffmpeg_audio_decoder.cc

Issue 9295020: Fix ChunkDemuxer seek deadlock (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix copyright year. Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/filters/chunk_demuxer.cc ('k') | media/filters/ffmpeg_audio_decoder_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_audio_decoder.h" 5 #include "media/filters/ffmpeg_audio_decoder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "media/base/audio_decoder_config.h" 8 #include "media/base/audio_decoder_config.h"
9 #include "media/base/data_buffer.h" 9 #include "media/base/data_buffer.h"
10 #include "media/base/demuxer.h" 10 #include "media/base/demuxer.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 CHECK(read_cb_.is_null()) << "Overlapping decodes are not supported."; 162 CHECK(read_cb_.is_null()) << "Overlapping decodes are not supported.";
163 163
164 read_cb_ = callback; 164 read_cb_ = callback;
165 ReadFromDemuxerStream(); 165 ReadFromDemuxerStream();
166 } 166 }
167 167
168 void FFmpegAudioDecoder::DoDecodeBuffer(const scoped_refptr<Buffer>& input) { 168 void FFmpegAudioDecoder::DoDecodeBuffer(const scoped_refptr<Buffer>& input) {
169 DCHECK_EQ(MessageLoop::current(), message_loop_); 169 DCHECK_EQ(MessageLoop::current(), message_loop_);
170 DCHECK(!read_cb_.is_null()); 170 DCHECK(!read_cb_.is_null());
171 171
172 if (!input) {
173 // DemuxeStream::Read() was aborted so we abort the decoder's pending read.
174 DeliverSamples(NULL);
175 return;
176 }
177
172 // FFmpeg tends to seek Ogg audio streams in the middle of nowhere, giving us 178 // FFmpeg tends to seek Ogg audio streams in the middle of nowhere, giving us
173 // a whole bunch of AV_NOPTS_VALUE packets. Discard them until we find 179 // a whole bunch of AV_NOPTS_VALUE packets. Discard them until we find
174 // something valid. Refer to http://crbug.com/49709 180 // something valid. Refer to http://crbug.com/49709
175 if (input->GetTimestamp() == kNoTimestamp() && 181 if (input->GetTimestamp() == kNoTimestamp() &&
176 estimated_next_timestamp_ == kNoTimestamp() && 182 estimated_next_timestamp_ == kNoTimestamp() &&
177 !input->IsEndOfStream()) { 183 !input->IsEndOfStream()) {
178 ReadFromDemuxerStream(); 184 ReadFromDemuxerStream();
179 return; 185 return;
180 } 186 }
181 187
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 } 291 }
286 292
287 void FFmpegAudioDecoder::DeliverSamples(const scoped_refptr<Buffer>& samples) { 293 void FFmpegAudioDecoder::DeliverSamples(const scoped_refptr<Buffer>& samples) {
288 // Reset the callback before running to protect against reentrancy. 294 // Reset the callback before running to protect against reentrancy.
289 ReadCB read_cb = read_cb_; 295 ReadCB read_cb = read_cb_;
290 read_cb_.Reset(); 296 read_cb_.Reset();
291 read_cb.Run(samples); 297 read_cb.Run(samples);
292 } 298 }
293 299
294 } // namespace media 300 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/chunk_demuxer.cc ('k') | media/filters/ffmpeg_audio_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698