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

Unified Diff: media/filters/decoder_stream.cc

Issue 1954633002: MEDIA_LOG for large encoded timestamp gaps in decoder stream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: New AudioTimestampValidator class and tests 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/decoder_stream.h ('k') | media/filters/decoder_stream_traits.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/decoder_stream.cc
diff --git a/media/filters/decoder_stream.cc b/media/filters/decoder_stream.cc
index 039b2b95f2276517e89902fc4815227d040b6cd4..55fad6c4406f53c3c5dc56fcbf0ae8e6c65aeaab 100644
--- a/media/filters/decoder_stream.cc
+++ b/media/filters/decoder_stream.cc
@@ -42,6 +42,16 @@ const char* GetTraceString<DemuxerStream::AUDIO>() {
return "DecoderStream<AUDIO>::Decode";
}
+template <typename T>
+AudioBuffer* GetAudioBuffer(T* buffer_ptr) {
+ return nullptr;
+}
+
+template <>
+AudioBuffer* GetAudioBuffer<>(AudioBuffer* buffer_ptr) {
+ return buffer_ptr;
+}
+
template <DemuxerStream::Type StreamType>
DecoderStream<StreamType>::DecoderStream(
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
@@ -110,6 +120,11 @@ void DecoderStream<StreamType>::Initialize(
waiting_for_decryption_key_cb_ = waiting_for_decryption_key_cb;
stream_ = stream;
+ if (DecoderStreamTraits<StreamType>::kShouldValidateTimestamps) {
+ audio_ts_validator_.reset(new AudioTimestampValidator(
+ stream_->audio_decoder_config(), media_log_));
+ }
+
state_ = STATE_INITIALIZING;
SelectDecoder(cdm_context);
}
@@ -166,6 +181,11 @@ void DecoderStream<StreamType>::Reset(const base::Closure& closure) {
ready_outputs_.clear();
+ if (DecoderStreamTraits<StreamType>::kShouldValidateTimestamps) {
+ audio_ts_validator_.reset(new AudioTimestampValidator(
+ stream_->audio_decoder_config(), media_log_));
+ }
+
// It's possible to have received a DECODE_ERROR and entered STATE_ERROR right
// before a Reset() is executed. If we are still waiting for a demuxer read,
// OnBufferReady() will handle the reset callback.
@@ -348,6 +368,9 @@ void DecoderStream<StreamType>::DecodeInternal(
DCHECK(reset_cb_.is_null());
DCHECK(buffer.get());
+ if (DecoderStreamTraits<StreamType>::kShouldValidateTimestamps)
+ audio_ts_validator_->CheckForTimestampGap(buffer);
+
int buffer_size = buffer->end_of_stream() ? 0 : buffer->data_size();
TRACE_EVENT_ASYNC_BEGIN2(
@@ -476,6 +499,16 @@ void DecoderStream<StreamType>::OnDecodeOutputReady(
if (!reset_cb_.is_null())
return;
+ if (DecoderStreamTraits<StreamType>::kShouldValidateTimestamps) {
+ // error: static_cast from 'media::VideoFrame *' to 'media::AudioBuffer *',
chcunningham 2016/05/27 21:35:05 This comment is just for CR discussion. I was surp
+ // which are not related by inheritance, is not allowed
+ // if (output.get()) {
+ // AudioBuffer* audio_buffer = static_cast<AudioBuffer*>(output.get());
+ // audio_ts_validator_->RecordOutputDuration(audio_buffer);
+ // }
+ audio_ts_validator_->RecordOutputDuration(GetAudioBuffer(output.get()));
+ }
+
++decoded_frames_since_fallback_;
// |decoder_| sucessfully decoded a frame. No need to keep buffers for a
« no previous file with comments | « media/filters/decoder_stream.h ('k') | media/filters/decoder_stream_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698