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

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

Issue 1918693003: Fix EOS reached before decoder fallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « media/base/fake_demuxer_stream.cc ('k') | media/filters/video_frame_stream_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/decoder_stream.h" 5 #include "media/filters/decoder_stream.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 template <> 204 template <>
205 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const { 205 int DecoderStream<DemuxerStream::AUDIO>::GetMaxDecodeRequests() const {
206 return 1; 206 return 1;
207 } 207 }
208 208
209 template <DemuxerStream::Type StreamType> 209 template <DemuxerStream::Type StreamType>
210 bool DecoderStream<StreamType>::CanDecodeMore() const { 210 bool DecoderStream<StreamType>::CanDecodeMore() const {
211 DCHECK(task_runner_->BelongsToCurrentThread()); 211 DCHECK(task_runner_->BelongsToCurrentThread());
212 212
213 bool buffers_left = !(fallback_buffers_.empty() && decoding_eos_);
214
213 // Limit total number of outputs stored in |ready_outputs_| and being decoded. 215 // Limit total number of outputs stored in |ready_outputs_| and being decoded.
214 // It only makes sense to saturate decoder completely when output queue is 216 // It only makes sense to saturate decoder completely when output queue is
215 // empty. 217 // empty.
216 int num_decodes = 218 int num_decodes =
217 static_cast<int>(ready_outputs_.size()) + pending_decode_requests_; 219 static_cast<int>(ready_outputs_.size()) + pending_decode_requests_;
218 return !decoding_eos_ && num_decodes < GetMaxDecodeRequests(); 220 return buffers_left && num_decodes < GetMaxDecodeRequests();
219 } 221 }
220 222
221 template <DemuxerStream::Type StreamType> 223 template <DemuxerStream::Type StreamType>
222 base::TimeDelta DecoderStream<StreamType>::AverageDuration() const { 224 base::TimeDelta DecoderStream<StreamType>::AverageDuration() const {
223 DCHECK(task_runner_->BelongsToCurrentThread()); 225 DCHECK(task_runner_->BelongsToCurrentThread());
224 return duration_tracker_.count() ? duration_tracker_.Average() 226 return duration_tracker_.count() ? duration_tracker_.Average()
225 : base::TimeDelta(); 227 : base::TimeDelta();
226 } 228 }
227 229
228 template <DemuxerStream::Type StreamType> 230 template <DemuxerStream::Type StreamType>
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 } 740 }
739 741
740 // The resetting process will be continued in OnDecoderReinitialized(). 742 // The resetting process will be continued in OnDecoderReinitialized().
741 ReinitializeDecoder(); 743 ReinitializeDecoder();
742 } 744 }
743 745
744 template class DecoderStream<DemuxerStream::VIDEO>; 746 template class DecoderStream<DemuxerStream::VIDEO>;
745 template class DecoderStream<DemuxerStream::AUDIO>; 747 template class DecoderStream<DemuxerStream::AUDIO>;
746 748
747 } // namespace media 749 } // namespace media
OLDNEW
« no previous file with comments | « media/base/fake_demuxer_stream.cc ('k') | media/filters/video_frame_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698