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

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

Issue 184853003: Cast: Add GetStats() extensions API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add files Created 6 years, 10 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 a1432770ced56074c98a2dc79e6588059b264360..a907e747ef6a2ed834c7ea0374cfbc441d76f69a 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_converter.h"
#include "media/cast/transport/cast_transport_config.h"
#include "media/cast/transport/cast_transport_sender.h"
@@ -182,6 +183,21 @@ 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<base::DictionaryValue> stats = media::cast::ConvertStats(
+ frame_stats, packet_stats);
+
+ callback.Run(stats.Pass());
+}
+
void CastSessionDelegate::StatusNotificationCB(
media::cast::transport::CastTransportStatus unused_status) {
DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());

Powered by Google App Engine
This is Rietveld 408576698