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

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

Issue 178073004: Cast: IPC from browser to renderer to send packet events from transport to cast library. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « chrome/renderer/media/cast_session_delegate.h ('k') | chrome/renderer/media/cast_transport_sender_ipc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f72c682a669c6ef27f412cf7dd239b945fa7faa6..6ae3952cd5235a53b816c6261389deda7b4745b3 100644
--- a/chrome/renderer/media/cast_session_delegate.cc
+++ b/chrome/renderer/media/cast_session_delegate.cc
@@ -63,14 +63,14 @@ CastSessionDelegate::~CastSessionDelegate() {
}
}
-void CastSessionDelegate::Initialize() {
+void CastSessionDelegate::Initialize(
+ const media::cast::CastLoggingConfig& logging_config) {
if (cast_environment_)
return; // Already initialized.
// CastSender uses the renderer's IO thread as the main thread. This reduces
// thread hopping for incoming video frames and outgoing network packets.
// There's no need to decode so no thread assigned for decoding.
- // Logging: enable raw events and stats collection.
cast_environment_ = new CastEnvironment(
scoped_ptr<base::TickClock>(new base::DefaultTickClock()).Pass(),
base::MessageLoopProxy::current(),
@@ -79,7 +79,7 @@ void CastSessionDelegate::Initialize() {
g_cast_threads.Get().GetVideoEncodeMessageLoopProxy(),
NULL,
base::MessageLoopProxy::current(),
- media::cast::GetLoggingConfigWithRawEventsAndStatsEnabled());
+ logging_config);
}
void CastSessionDelegate::StartAudio(
@@ -198,7 +198,10 @@ void CastSessionDelegate::StartSendingInternal() {
if (!audio_config_ || !video_config_)
return;
- Initialize();
+ // Logging: enable raw events and stats collection.
+ media::cast::CastLoggingConfig logging_config =
+ media::cast::GetLoggingConfigWithRawEventsAndStatsEnabled();
+ Initialize(logging_config);
// Rationale for using unretained: The callback cannot be called after the
// destruction of CastTransportSenderIPC, and they both share the same thread.
@@ -206,7 +209,9 @@ void CastSessionDelegate::StartSendingInternal() {
local_endpoint_,
remote_endpoint_,
base::Bind(&CastSessionDelegate::StatusNotificationCB,
- base::Unretained(this))));
+ base::Unretained(this)),
+ logging_config,
+ base::Bind(&CastSessionDelegate::LogRawEvents, base::Unretained(this))));
// TODO(hubbe): set config.aes_key and config.aes_iv_mask.
if (audio_config_) {
@@ -252,3 +257,20 @@ void CastSessionDelegate::InitializationResult(
}
}
+void CastSessionDelegate::LogRawEvents(
+ const std::vector<media::cast::PacketEvent>& packet_events) {
+ DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
+
+ for (std::vector<media::cast::PacketEvent>::const_iterator it =
+ packet_events.begin();
+ it != packet_events.end();
+ ++it) {
+ cast_environment_->Logging()->InsertPacketEvent(it->timestamp,
+ it->type,
+ it->rtp_timestamp,
+ it->frame_id,
+ it->packet_id,
+ it->max_packet_id,
+ it->size);
+ }
+}
« no previous file with comments | « chrome/renderer/media/cast_session_delegate.h ('k') | chrome/renderer/media/cast_transport_sender_ipc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698