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

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

Issue 2516243002: CastTransportIPC can send messages to uninitialized channel id. (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/media/cast_transport_ipc.cc
diff --git a/chrome/renderer/media/cast_transport_ipc.cc b/chrome/renderer/media/cast_transport_ipc.cc
index 518610fd3c41775523a5dbf9ca5a9372da43edde..1875281d0f1158dee24873a9a9e2c9a1c93e9fcb 100644
--- a/chrome/renderer/media/cast_transport_ipc.cc
+++ b/chrome/renderer/media/cast_transport_ipc.cc
@@ -21,18 +21,21 @@ CastTransportIPC::CastTransportIPC(
const media::cast::PacketReceiverCallback& packet_callback,
const media::cast::CastTransportStatusCallback& status_cb,
const media::cast::BulkRawEventsCallback& raw_events_cb)
- : packet_callback_(packet_callback),
+ : channel_id_(-1),
+ packet_callback_(packet_callback),
status_callback_(status_cb),
raw_events_callback_(raw_events_cb) {
if (CastIPCDispatcher::Get()) {
miu 2016/11/21 20:21:50 Note: It's unfortunate that the original author of
channel_id_ = CastIPCDispatcher::Get()->AddSender(this);
+ Send(new CastHostMsg_New(channel_id_, local_end_point, remote_end_point,
+ *options));
}
- Send(new CastHostMsg_New(channel_id_, local_end_point, remote_end_point,
- *options));
}
CastTransportIPC::~CastTransportIPC() {
- Send(new CastHostMsg_Delete(channel_id_));
+ if (channel_id_ != -1) {
+ Send(new CastHostMsg_Delete(channel_id_));
+ }
if (CastIPCDispatcher::Get()) {
CastIPCDispatcher::Get()->RemoveSender(channel_id_);
}
@@ -45,11 +48,13 @@ void CastTransportIPC::InitializeStream(
DCHECK(clients_.find(config.ssrc) == clients_.end());
clients_[config.ssrc] = std::move(rtcp_observer);
}
+ DCHECK(channel_id_ != -1);
Send(new CastHostMsg_InitializeStream(channel_id_, config));
}
void CastTransportIPC::InsertFrame(uint32_t ssrc,
const media::cast::EncodedFrame& frame) {
+ DCHECK(channel_id_ != -1);
Send(new CastHostMsg_InsertFrame(channel_id_, ssrc, frame));
}
@@ -57,6 +62,7 @@ void CastTransportIPC::SendSenderReport(
uint32_t ssrc,
base::TimeTicks current_time,
media::cast::RtpTimeTicks current_time_as_rtp_timestamp) {
+ DCHECK(channel_id_ != -1);
Send(new CastHostMsg_SendSenderReport(channel_id_, ssrc, current_time,
current_time_as_rtp_timestamp));
}
@@ -64,16 +70,19 @@ void CastTransportIPC::SendSenderReport(
void CastTransportIPC::CancelSendingFrames(
uint32_t ssrc,
const std::vector<media::cast::FrameId>& frame_ids) {
+ DCHECK(channel_id_ != -1);
Send(new CastHostMsg_CancelSendingFrames(channel_id_, ssrc, frame_ids));
}
void CastTransportIPC::ResendFrameForKickstart(uint32_t ssrc,
media::cast::FrameId frame_id) {
+ DCHECK(channel_id_ != -1);
Send(new CastHostMsg_ResendFrameForKickstart(channel_id_, ssrc, frame_id));
}
void CastTransportIPC::AddValidRtpReceiver(uint32_t rtp_sender_ssrc,
uint32_t rtp_receiver_ssrc) {
+ DCHECK(channel_id_ != -1);
Send(new CastHostMsg_AddValidRtpReceiver(channel_id_, rtp_sender_ssrc,
rtp_receiver_ssrc));
}
@@ -81,6 +90,7 @@ void CastTransportIPC::AddValidRtpReceiver(uint32_t rtp_sender_ssrc,
void CastTransportIPC::InitializeRtpReceiverRtcpBuilder(
uint32_t rtp_receiver_ssrc,
const media::cast::RtcpTimeData& time_data) {
+ DCHECK(channel_id_ != -1);
Send(new CastHostMsg_InitializeRtpReceiverRtcpBuilder(
channel_id_, rtp_receiver_ssrc, time_data));
}
@@ -88,26 +98,31 @@ void CastTransportIPC::InitializeRtpReceiverRtcpBuilder(
void CastTransportIPC::AddCastFeedback(
const media::cast::RtcpCastMessage& cast_message,
base::TimeDelta target_delay) {
+ DCHECK(channel_id_ != -1);
Send(
new CastHostMsg_AddCastFeedback(channel_id_, cast_message, target_delay));
}
void CastTransportIPC::AddPli(const media::cast::RtcpPliMessage& pli_message) {
+ DCHECK(channel_id_ != -1);
Send(new CastHostMsg_AddPli(channel_id_, pli_message));
}
void CastTransportIPC::AddRtcpEvents(
const media::cast::ReceiverRtcpEventSubscriber::RtcpEvents& rtcp_events) {
+ DCHECK(channel_id_ != -1);
Send(new CastHostMsg_AddRtcpEvents(channel_id_, rtcp_events));
}
void CastTransportIPC::AddRtpReceiverReport(
const media::cast::RtcpReportBlock& rtp_receiver_report_block) {
+ DCHECK(channel_id_ != -1);
Send(new CastHostMsg_AddRtpReceiverReport(channel_id_,
rtp_receiver_report_block));
}
void CastTransportIPC::SendRtcpFromRtpReceiver() {
+ DCHECK(channel_id_ != -1);
Send(new CastHostMsg_SendRtcpFromRtpReceiver(channel_id_));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698