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

Unified Diff: media/filters/ffmpeg_demuxer.cc

Issue 9234066: Detect errors in audio output and report them upstream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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
« no previous file with comments | « media/filters/ffmpeg_demuxer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_demuxer.cc
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index 6e3627eab7434c78ab048295b09f3e2b032d7372..0cb2ea44f9e17e30dfe662b0b505529d75985f2f 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -289,7 +289,8 @@ FFmpegDemuxer::FFmpegDemuxer(MessageLoop* message_loop, bool local_source)
max_duration_(base::TimeDelta::FromMicroseconds(-1)),
deferred_status_(PIPELINE_OK),
first_seek_hack_(true),
- start_time_(kNoTimestamp()) {
+ start_time_(kNoTimestamp()),
+ audio_disabled_(false) {
DCHECK(message_loop_);
}
@@ -662,7 +663,9 @@ void FFmpegDemuxer::DemuxTask() {
// Defend against ffmpeg giving us a bad stream index.
if (packet->stream_index >= 0 &&
packet->stream_index < static_cast<int>(streams_.size()) &&
- streams_[packet->stream_index]) {
+ streams_[packet->stream_index] &&
+ (!audio_disabled_ ||
+ streams_[packet->stream_index]->type() != DemuxerStream::AUDIO)) {
FFmpegDemuxerStream* demuxer_stream = streams_[packet->stream_index];
// If a packet is returned by FFmpeg's av_parser_parse2()
@@ -699,6 +702,7 @@ void FFmpegDemuxer::StopTask(const base::Closure& callback) {
void FFmpegDemuxer::DisableAudioStreamTask() {
DCHECK_EQ(MessageLoop::current(), message_loop_);
+ audio_disabled_ = true;
StreamVector::iterator iter;
for (iter = streams_.begin(); iter != streams_.end(); ++iter) {
if (*iter && (*iter)->type() == DemuxerStream::AUDIO) {
@@ -722,8 +726,10 @@ void FFmpegDemuxer::StreamHasEnded() {
DCHECK_EQ(MessageLoop::current(), message_loop_);
StreamVector::iterator iter;
for (iter = streams_.begin(); iter != streams_.end(); ++iter) {
- if (!*iter)
+ if (!*iter ||
+ (audio_disabled_ && (*iter)->type() == DemuxerStream::AUDIO)) {
continue;
+ }
scoped_ptr_malloc<AVPacket, ScopedPtrAVFreePacket> packet(new AVPacket());
memset(packet.get(), 0, sizeof(*packet.get()));
(*iter)->EnqueuePacket(packet.Pass());
« no previous file with comments | « media/filters/ffmpeg_demuxer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698