| 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 a1432770ced56074c98a2dc79e6588059b264360..08fcf27e6e62e70a6dc139165eb55d79863a0ff8 100644
|
| --- a/chrome/renderer/media/cast_session_delegate.cc
|
| +++ b/chrome/renderer/media/cast_session_delegate.cc
|
| @@ -16,6 +16,7 @@
|
| #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/stats_serializer.h"
|
| #include "media/cast/transport/cast_transport_config.h"
|
| #include "media/cast/transport/cast_transport_sender.h"
|
|
|
| @@ -182,6 +183,26 @@ void CastSessionDelegate::GetEventLogsAndReset(
|
| callback.Run(serialized_log.Pass());
|
| }
|
|
|
| +void CastSessionDelegate::GetStatsAndReset(bool is_audio,
|
| + const StatsCallback& callback) {
|
| + media::cast::FrameStatsMap frame_stats =
|
| + cast_environment_->Logging()->GetFrameStatsData(
|
| + is_audio ? media::cast::AUDIO_EVENT : media::cast::VIDEO_EVENT);
|
| + media::cast::PacketStatsMap packet_stats =
|
| + cast_environment_->Logging()->GetPacketStatsData(
|
| + is_audio ? media::cast::AUDIO_EVENT : media::cast::VIDEO_EVENT);
|
| + scoped_ptr<std::string> result(new std::string);
|
| + bool success =
|
| + media::cast::SerializeStats(frame_stats, packet_stats, result.get());
|
| + if (!success) {
|
| + VLOG(2) << "Failed to serialized stats.";
|
| + callback.Run(make_scoped_ptr(new std::string).Pass());
|
| + return;
|
| + }
|
| +
|
| + callback.Run(result.Pass());
|
| +}
|
| +
|
| void CastSessionDelegate::StatusNotificationCB(
|
| media::cast::transport::CastTransportStatus unused_status) {
|
| DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
|
|
|