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

Unified Diff: chrome/renderer/media/cast_session_delegate.cc

Issue 236123003: Cast: Provide more meaningful stats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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
Index: chrome/renderer/media/cast_session_delegate.cc
diff --git a/chrome/renderer/media/cast_session_delegate.cc b/chrome/renderer/media/cast_session_delegate.cc
index 919324966b54de06f43a3120c02fc1665b98d290..cc5060fc9da5bbdd3c47da4f1789fffe6ff7b83b 100644
--- a/chrome/renderer/media/cast_session_delegate.cc
+++ b/chrome/renderer/media/cast_session_delegate.cc
@@ -16,8 +16,8 @@
#include "media/cast/logging/encoding_event_subscriber.h"
#include "media/cast/logging/log_serializer.h"
#include "media/cast/logging/logging_defines.h"
+#include "media/cast/logging/receiver_time_offset_estimator_impl.h"
#include "media/cast/logging/stats_event_subscriber.h"
-#include "media/cast/logging/stats_util.h"
#include "media/cast/transport/cast_transport_config.h"
#include "media/cast/transport/cast_transport_sender.h"
@@ -53,6 +53,10 @@ CastSessionDelegate::~CastSessionDelegate() {
DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
if (cast_environment_.get()) {
+ if (receiver_offset_estimator_.get()) {
+ cast_environment_->Logging()->RemoveRawEventSubscriber(
+ receiver_offset_estimator_.get());
+ }
if (audio_event_subscriber_.get()) {
cast_environment_->Logging()->RemoveRawEventSubscriber(
audio_event_subscriber_.get());
@@ -146,6 +150,12 @@ void CastSessionDelegate::ToggleLogging(bool is_audio, bool enable) {
if (!cast_environment_.get())
return;
if (enable) {
+ if (!receiver_offset_estimator_.get()) {
miu 2014/04/15 21:29:43 There's a huge amount of copy-and-paste going thro
imcheng 2014/04/17 19:19:06 Per offline discussion I am defining a new struct
+ receiver_offset_estimator_.reset(
+ new media::cast::ReceiverTimeOffsetEstimatorImpl);
+ cast_environment_->Logging()->AddRawEventSubscriber(
+ receiver_offset_estimator_.get());
+ }
if (is_audio) {
if (!audio_event_subscriber_.get()) {
audio_event_subscriber_.reset(new media::cast::EncodingEventSubscriber(
@@ -154,8 +164,10 @@ void CastSessionDelegate::ToggleLogging(bool is_audio, bool enable) {
audio_event_subscriber_.get());
}
if (!audio_stats_subscriber_.get()) {
- audio_stats_subscriber_.reset(
- new media::cast::StatsEventSubscriber(media::cast::AUDIO_EVENT));
+ audio_stats_subscriber_.reset(new media::cast::StatsEventSubscriber(
+ media::cast::AUDIO_EVENT,
+ cast_environment_->Clock(),
+ receiver_offset_estimator_.get()));
cast_environment_->Logging()->AddRawEventSubscriber(
audio_stats_subscriber_.get());
}
@@ -167,13 +179,21 @@ void CastSessionDelegate::ToggleLogging(bool is_audio, bool enable) {
video_event_subscriber_.get());
}
if (!video_stats_subscriber_.get()) {
- video_stats_subscriber_.reset(
- new media::cast::StatsEventSubscriber(media::cast::VIDEO_EVENT));
+ video_stats_subscriber_.reset(new media::cast::StatsEventSubscriber(
+ media::cast::VIDEO_EVENT,
+ cast_environment_->Clock(),
+ receiver_offset_estimator_.get()));
cast_environment_->Logging()->AddRawEventSubscriber(
video_stats_subscriber_.get());
}
}
} else {
+ if (receiver_offset_estimator_.get()) {
+ cast_environment_->Logging()->RemoveRawEventSubscriber(
+ receiver_offset_estimator_.get());
+ receiver_offset_estimator_.reset();
+ }
+
if (is_audio) {
if (audio_event_subscriber_.get()) {
cast_environment_->Logging()->RemoveRawEventSubscriber(
@@ -250,15 +270,9 @@ void CastSessionDelegate::GetStatsAndReset(bool is_audio,
return;
}
- media::cast::FrameStatsMap frame_stats;
- subscriber->GetFrameStats(&frame_stats);
- media::cast::PacketStatsMap packet_stats;
- subscriber->GetPacketStats(&packet_stats);
+ scoped_ptr<base::DictionaryValue> stats = subscriber->GetStats();
subscriber->Reset();
- scoped_ptr<base::DictionaryValue> stats = media::cast::ConvertStats(
- frame_stats, packet_stats);
-
callback.Run(stats.Pass());
}

Powered by Google App Engine
This is Rietveld 408576698