| 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()) {
|
| + 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());
|
| }
|
|
|
|
|