| 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 faab4f974b33317423bb82a956d3eb0901467aaf..f2f01b0a240257411a45bdf6f3725bb9cb944853 100644
|
| --- a/chrome/renderer/media/cast_session_delegate.cc
|
| +++ b/chrome/renderer/media/cast_session_delegate.cc
|
| @@ -59,7 +59,8 @@ CastSessionDelegate::~CastSessionDelegate() {
|
| }
|
| }
|
|
|
| -void CastSessionDelegate::Initialize() {
|
| +void CastSessionDelegate::Initialize(
|
| + const media::cast::CastLoggingConfig& logging_config) {
|
| if (cast_environment_)
|
| return; // Already initialized.
|
|
|
| @@ -75,7 +76,7 @@ void CastSessionDelegate::Initialize() {
|
| g_cast_threads.Get().GetVideoEncodeMessageLoopProxy(),
|
| NULL,
|
| base::MessageLoopProxy::current(),
|
| - media::cast::GetDefaultCastSenderLoggingConfig());
|
| + logging_config);
|
| }
|
|
|
| void CastSessionDelegate::StartAudio(
|
| @@ -135,19 +136,25 @@ void CastSessionDelegate::StartSendingInternal() {
|
| if (!audio_config_ && !video_config_)
|
| return;
|
|
|
| - Initialize();
|
| + // TODO(imcheng): Enable raw event and stats collection.
|
| + media::cast::CastLoggingConfig logging_config =
|
| + media::cast::GetDefaultCastSenderLoggingConfig();
|
|
|
| - media::cast::transport::CastTransportConfig config;
|
| + Initialize(logging_config);
|
|
|
| - // TODO(hubbe): set config.aes_key and config.aes_iv_mask.
|
| - config.local_endpoint = local_endpoint_;
|
| - config.receiver_endpoint = remote_endpoint_;
|
| + media::cast::transport::CastTransportConfig transport_config;
|
| + transport_config.enable_raw_event_logging =
|
| + logging_config.enable_raw_data_collection;
|
| +
|
| + // TODO(hubbe): set transport_config.aes_key and transport_config.aes_iv_mask.
|
| + transport_config.local_endpoint = local_endpoint_;
|
| + transport_config.receiver_endpoint = remote_endpoint_;
|
| if (audio_config_) {
|
| - config.audio_ssrc = audio_config_->sender_ssrc;
|
| - config.audio_codec = audio_config_->codec;
|
| - config.audio_rtp_config = audio_config_->rtp_config;
|
| - config.audio_frequency = audio_config_->frequency;
|
| - config.audio_channels = audio_config_->channels;
|
| + transport_config.audio_ssrc = audio_config_->sender_ssrc;
|
| + transport_config.audio_codec = audio_config_->codec;
|
| + transport_config.audio_rtp_config = audio_config_->rtp_config;
|
| + transport_config.audio_frequency = audio_config_->frequency;
|
| + transport_config.audio_channels = audio_config_->channels;
|
|
|
| if (!audio_event_subscriber_.get()) {
|
| audio_event_subscriber_.reset(new media::cast::EncodingEventSubscriber(
|
| @@ -157,9 +164,9 @@ void CastSessionDelegate::StartSendingInternal() {
|
| }
|
| }
|
| if (video_config_) {
|
| - config.video_ssrc = video_config_->sender_ssrc;
|
| - config.video_codec = video_config_->codec;
|
| - config.video_rtp_config = video_config_->rtp_config;
|
| + transport_config.video_ssrc = video_config_->sender_ssrc;
|
| + transport_config.video_codec = video_config_->codec;
|
| + transport_config.video_rtp_config = video_config_->rtp_config;
|
|
|
| if (!video_event_subscriber_.get()) {
|
| video_event_subscriber_.reset(new media::cast::EncodingEventSubscriber(
|
| @@ -170,9 +177,10 @@ void CastSessionDelegate::StartSendingInternal() {
|
| }
|
|
|
| cast_transport_.reset(new CastTransportSenderIPC(
|
| - config,
|
| + transport_config,
|
| base::Bind(&CastSessionDelegate::StatusNotificationCB,
|
| - base::Unretained(this))));
|
| + base::Unretained(this)),
|
| + base::Bind(&CastSessionDelegate::LogRawEvents, base::Unretained(this))));
|
|
|
| cast_sender_.reset(CastSender::CreateCastSender(
|
| cast_environment_,
|
| @@ -199,3 +207,21 @@ 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);
|
| + }
|
| +}
|
|
|