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

Unified Diff: chrome/browser/media/cast_transport_host_filter.cc

Issue 2048033003: Refactoring: CastTransport InitializeAudio/InitializeVideo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comments. Created 4 years, 5 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/browser/media/cast_transport_host_filter.cc
diff --git a/chrome/browser/media/cast_transport_host_filter.cc b/chrome/browser/media/cast_transport_host_filter.cc
index a4bf0f13198668cdac205f93b8c7439667a3aab1..a26cd5204a6bd2a73d8d743d28707a93699c6cd0 100644
--- a/chrome/browser/media/cast_transport_host_filter.cc
+++ b/chrome/browser/media/cast_transport_host_filter.cc
@@ -118,8 +118,7 @@ bool CastTransportHostFilter::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(CastTransportHostFilter, message)
IPC_MESSAGE_HANDLER(CastHostMsg_New, OnNew)
IPC_MESSAGE_HANDLER(CastHostMsg_Delete, OnDelete)
- IPC_MESSAGE_HANDLER(CastHostMsg_InitializeAudio, OnInitializeAudio)
- IPC_MESSAGE_HANDLER(CastHostMsg_InitializeVideo, OnInitializeVideo)
+ IPC_MESSAGE_HANDLER(CastHostMsg_InitializeStream, OnInitializeStream)
IPC_MESSAGE_HANDLER(CastHostMsg_InsertFrame, OnInsertFrame)
IPC_MESSAGE_HANDLER(CastHostMsg_SendSenderReport,
OnSendSenderReport)
@@ -173,7 +172,7 @@ void CastTransportHostFilter::OnNew(int32_t channel_id,
std::unique_ptr<media::cast::CastTransport> sender =
media::cast::CastTransport::Create(
&clock_, base::TimeDelta::FromSeconds(kSendRawEventsIntervalSecs),
- base::WrapUnique(new TransportClient(channel_id, this)),
+ base::MakeUnique<TransportClient>(channel_id, this),
std::move(udp_transport), base::ThreadTaskRunnerHandle::Get());
sender->SetOptions(options);
id_map_.AddWithID(sender.release(), channel_id);
@@ -196,33 +195,17 @@ void CastTransportHostFilter::OnDelete(int32_t channel_id) {
}
}
-// TODO(xjz): Replace all the separate "init/start audio" and "init/start video"
-// methods with a single "init/start rtp stream" that handles either media type.
-void CastTransportHostFilter::OnInitializeAudio(
+void CastTransportHostFilter::OnInitializeStream(
int32_t channel_id,
const media::cast::CastTransportRtpConfig& config) {
media::cast::CastTransport* sender = id_map_.Lookup(channel_id);
if (sender) {
- sender->InitializeAudio(
- config, base::WrapUnique(new RtcpClient(channel_id, config.ssrc,
- weak_factory_.GetWeakPtr())));
+ sender->InitializeStream(
+ config, base::MakeUnique<RtcpClient>(channel_id, config.ssrc,
+ weak_factory_.GetWeakPtr()));
} else {
- DVLOG(1)
- << "CastTransportHostFilter::OnInitializeAudio on non-existing channel";
- }
-}
-
-void CastTransportHostFilter::OnInitializeVideo(
- int32_t channel_id,
- const media::cast::CastTransportRtpConfig& config) {
- media::cast::CastTransport* sender = id_map_.Lookup(channel_id);
- if (sender) {
- sender->InitializeVideo(
- config, base::WrapUnique(new RtcpClient(channel_id, config.ssrc,
- weak_factory_.GetWeakPtr())));
- } else {
- DVLOG(1)
- << "CastTransportHostFilter::OnInitializeVideo on non-existing channel";
+ DVLOG(1) << "CastTransportHostFilter::OnInitializeStream on non-existing "
+ "channel";
}
}
« no previous file with comments | « chrome/browser/media/cast_transport_host_filter.h ('k') | chrome/browser/media/cast_transport_host_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698