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

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

Issue 174183003: Cast:Transport: Dividing A/V Initialization pipeline (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixing errors and yet another rebase 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
« 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 a1432770ced56074c98a2dc79e6588059b264360..f72c682a669c6ef27f412cf7dd239b945fa7faa6 100644
--- a/chrome/renderer/media/cast_session_delegate.cc
+++ b/chrome/renderer/media/cast_session_delegate.cc
@@ -45,7 +45,8 @@ const int kMaxAudioEventEntries = kMaxSerializedBytes / 75;
CastSessionDelegate::CastSessionDelegate()
: transport_configured_(false),
io_message_loop_proxy_(
- content::RenderThread::Get()->GetIOMessageLoopProxy()) {
+ content::RenderThread::Get()->GetIOMessageLoopProxy()),
+ weak_factory_(this) {
DCHECK(io_message_loop_proxy_);
}
@@ -101,9 +102,8 @@ void CastSessionDelegate::StartVideo(
StartSendingInternal();
}
-void CastSessionDelegate::StartUDP(
- const net::IPEndPoint& local_endpoint,
- const net::IPEndPoint& remote_endpoint) {
+void CastSessionDelegate::StartUDP(const net::IPEndPoint& local_endpoint,
+ const net::IPEndPoint& remote_endpoint) {
DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
transport_configured_ = true;
local_endpoint_ = local_endpoint;
@@ -154,7 +154,6 @@ void CastSessionDelegate::GetEventLogsAndReset(
media::cast::EncodingEventSubscriber* subscriber = is_audio ?
audio_event_subscriber_.get() : video_event_subscriber_.get();
if (!subscriber) {
- VLOG(2) << "Logging is currently disabled.";
callback.Run(make_scoped_ptr(new std::string).Pass());
return;
}
@@ -201,36 +200,39 @@ void CastSessionDelegate::StartSendingInternal() {
Initialize();
- media::cast::transport::CastTransportConfig config;
+ // Rationale for using unretained: The callback cannot be called after the
+ // destruction of CastTransportSenderIPC, and they both share the same thread.
+ cast_transport_.reset(new CastTransportSenderIPC(
+ local_endpoint_,
+ remote_endpoint_,
+ base::Bind(&CastSessionDelegate::StatusNotificationCB,
+ base::Unretained(this))));
// TODO(hubbe): set config.aes_key and config.aes_iv_mask.
- config.local_endpoint = local_endpoint_;
- 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;
+ media::cast::transport::CastTransportAudioConfig config;
+ config.base.ssrc = audio_config_->sender_ssrc;
+ config.codec = audio_config_->codec;
+ config.base.rtp_config = audio_config_->rtp_config;
+ config.frequency = audio_config_->frequency;
+ config.channels = audio_config_->channels;
+ cast_transport_->InitializeAudio(config);
}
if (video_config_) {
- config.video_ssrc = video_config_->sender_ssrc;
- config.video_codec = video_config_->codec;
- config.video_rtp_config = video_config_->rtp_config;
+ media::cast::transport::CastTransportVideoConfig config;
+ config.base.ssrc = video_config_->sender_ssrc;
+ config.codec = video_config_->codec;
+ config.base.rtp_config = video_config_->rtp_config;
+ cast_transport_->InitializeVideo(config);
}
- cast_transport_.reset(new CastTransportSenderIPC(
- config,
- base::Bind(&CastSessionDelegate::StatusNotificationCB,
- base::Unretained(this))));
-
cast_sender_.reset(CastSender::CreateCastSender(
cast_environment_,
audio_config_.get(),
video_config_.get(),
NULL, // GPU.
base::Bind(&CastSessionDelegate::InitializationResult,
- base::Unretained(this)),
+ weak_factory_.GetWeakPtr()),
cast_transport_.get()));
cast_transport_->SetPacketReceiver(cast_sender_->packet_receiver());
}
« 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