summaryrefslogtreecommitdiffstats
path: root/media/base/pipeline_impl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'media/base/pipeline_impl.cc')
-rw-r--r--media/base/pipeline_impl.cc24
1 files changed, 21 insertions, 3 deletions
diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc
index a0fda64..76a07cd 100644
--- a/media/base/pipeline_impl.cc
+++ b/media/base/pipeline_impl.cc
@@ -274,6 +274,11 @@ PipelineError PipelineImpl::GetError() const {
return error_;
}
+PipelineStatistics PipelineImpl::GetStatistics() const {
+ base::AutoLock auto_lock(lock_);
+ return statistics_;
+}
+
void PipelineImpl::SetCurrentReadPosition(int64 offset) {
base::AutoLock auto_lock(lock_);
@@ -530,6 +535,15 @@ void PipelineImpl::OnTeardownStateTransition() {
NewRunnableMethod(this, &PipelineImpl::TeardownStateTransitionTask));
}
+// Called from any thread.
+void PipelineImpl::OnUpdateStatistics(const PipelineStatistics& stats) {
+ base::AutoLock auto_lock(lock_);
+ statistics_.audio_bytes_decoded += stats.audio_bytes_decoded;
+ statistics_.video_bytes_decoded += stats.video_bytes_decoded;
+ statistics_.video_frames_decoded += stats.video_frames_decoded;
+ statistics_.video_frames_dropped += stats.video_frames_dropped;
+}
+
void PipelineImpl::StartTask(FilterCollection* filter_collection,
const std::string& url,
PipelineCallback* start_callback) {
@@ -1074,7 +1088,8 @@ bool PipelineImpl::InitializeAudioDecoder(
pipeline_init_state_->audio_decoder_ = audio_decoder;
audio_decoder->Initialize(
stream,
- NewCallback(this, &PipelineImpl::OnFilterInitialize));
+ NewCallback(this, &PipelineImpl::OnFilterInitialize),
+ NewCallback(this, &PipelineImpl::OnUpdateStatistics));
return true;
}
@@ -1103,7 +1118,8 @@ bool PipelineImpl::InitializeVideoDecoder(
pipeline_init_state_->video_decoder_ = video_decoder;
video_decoder->Initialize(
stream,
- NewCallback(this, &PipelineImpl::OnFilterInitialize));
+ NewCallback(this, &PipelineImpl::OnFilterInitialize),
+ NewCallback(this, &PipelineImpl::OnUpdateStatistics));
return true;
}
@@ -1147,7 +1163,9 @@ bool PipelineImpl::InitializeVideoRenderer(
return false;
video_renderer_->Initialize(
- decoder, NewCallback(this, &PipelineImpl::OnFilterInitialize));
+ decoder,
+ NewCallback(this, &PipelineImpl::OnFilterInitialize),
+ NewCallback(this, &PipelineImpl::OnUpdateStatistics));
return true;
}