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 ca1042e2bf64d945adf58be5b391daf5a94662eb..0521297d0c195d91e6d9b780b44b2c1d03967cd8 100644 |
--- a/chrome/renderer/media/cast_session_delegate.cc |
+++ b/chrome/renderer/media/cast_session_delegate.cc |
@@ -6,6 +6,7 @@ |
#include "base/logging.h" |
#include "base/message_loop/message_loop_proxy.h" |
+#include "chrome/renderer/media/cast_transport_sender_ipc.h" |
#include "content/public/renderer/p2p_socket_client.h" |
#include "content/public/renderer/render_thread.h" |
#include "media/cast/cast_config.h" |
@@ -20,59 +21,15 @@ using media::cast::CastEnvironment; |
using media::cast::CastSender; |
using media::cast::VideoSenderConfig; |
-namespace { |
- |
-// This is a dummy class that does nothing. This is needed temporarily |
-// to enable tests for cast.streaming extension APIs. |
-// The real implementation of CastTransportSender is to use IPC to send |
-// data to the browser process. |
-// See crbug.com/327482 for more details. |
-class DummyTransport : public media::cast::transport::CastTransportSender { |
- public: |
- DummyTransport() {} |
- virtual ~DummyTransport() {} |
- |
- // CastTransportSender implementations. |
- virtual void SetPacketReceiver( |
- const media::cast::transport::PacketReceiverCallback& packet_receiver) |
- OVERRIDE {} |
- virtual void InsertCodedAudioFrame( |
- const media::cast::transport::EncodedAudioFrame* audio_frame, |
- const base::TimeTicks& recorded_time) OVERRIDE {} |
- virtual void InsertCodedVideoFrame( |
- const media::cast::transport::EncodedVideoFrame* video_frame, |
- const base::TimeTicks& capture_time) OVERRIDE {} |
- virtual void SendRtcpFromRtpSender( |
- uint32 packet_type_flags, |
- const media::cast::transport::RtcpSenderInfo& sender_info, |
- const media::cast::transport::RtcpDlrrReportBlock& dlrr, |
- const media::cast::transport::RtcpSenderLogMessage& sender_log, |
- uint32 sending_ssrc, |
- const std::string& c_name) OVERRIDE {} |
- virtual void ResendPackets( |
- bool is_audio, |
- const media::cast::transport::MissingFramesAndPacketsMap& missing_packets) |
- OVERRIDE {} |
- virtual void SubscribeAudioRtpStatsCallback( |
- const media::cast::transport::CastTransportRtpStatistics& callback) |
- OVERRIDE {} |
- virtual void SubscribeVideoRtpStatsCallback( |
- const media::cast::transport::CastTransportRtpStatistics& callback) |
- OVERRIDE {} |
- |
- private: |
- DISALLOW_COPY_AND_ASSIGN(DummyTransport); |
-}; |
- |
-} // namespace |
- |
CastSessionDelegate::CastSessionDelegate() |
: audio_encode_thread_("CastAudioEncodeThread"), |
video_encode_thread_("CastVideoEncodeThread"), |
audio_configured_(false), |
video_configured_(false), |
+ transport_configured_(false), |
io_message_loop_proxy_( |
content::RenderThread::Get()->GetIOMessageLoopProxy()) { |
+ DCHECK(io_message_loop_proxy_); |
} |
CastSessionDelegate::~CastSessionDelegate() { |
@@ -101,6 +58,20 @@ void CastSessionDelegate::StartVideo( |
StartSendingInternal(); |
} |
+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; |
+ remote_endpoint_ = remote_endpoint; |
+ StartSendingInternal(); |
+} |
+ |
+static void IgnoreStatusCB( |
+ media::cast::transport::CastTransportStatus unused_status) { |
+} |
+ |
// TODO(pwestin): This design does not work; as soon as audio or video is |
// initialized it will prevent the other from being enabled. |
void CastSessionDelegate::StartSendingInternal() { |
@@ -109,10 +80,27 @@ void CastSessionDelegate::StartSendingInternal() { |
if (cast_environment_) |
return; |
- if (!audio_configured_ || !video_configured_) |
+ if (!audio_configured_ || !video_configured_ || !transport_configured_) |
return; |
- cast_transport_.reset(new DummyTransport()); |
+ media::cast::transport::CastTransportConfig config; |
+ |
+ // TODO(hubbe): set config.aes_key and config.aes_iv_mask. |
+ config.local_endpoint = local_endpoint_; |
+ config.receiver_endpoint = remote_endpoint_; |
+ config.audio_ssrc = audio_config_.sender_ssrc; |
+ config.video_ssrc = video_config_.sender_ssrc; |
+ config.audio_codec = audio_config_.codec; |
+ config.video_codec = video_config_.codec; |
+ config.audio_rtp_config = audio_config_.rtp_config; |
+ config.video_rtp_config = video_config_.rtp_config; |
+ config.audio_frequency = audio_config_.frequency; |
+ config.audio_channels = audio_config_.channels; |
+ |
+ // TODO(hubbe): Status callback is not supposed to be ignored. |
+ cast_transport_.reset(NewCastTransportSenderIPC( |
+ config, |
+ base::Bind(&IgnoreStatusCB))); |
acolwell GONE FROM CHROMIUM
2014/02/11 00:57:38
Remove the callback from the method signature unti
hubbe
2014/02/12 00:54:24
But if I do that, I still need an IgnoreStatusCB l
|
audio_encode_thread_.Start(); |
video_encode_thread_.Start(); |
@@ -138,6 +126,7 @@ void CastSessionDelegate::StartSendingInternal() { |
base::Bind(&CastSessionDelegate::InitializationResult, |
base::Unretained(this)), |
cast_transport_.get())); |
+ cast_transport_->SetPacketReceiver(cast_sender_->packet_receiver()); |
} |
void CastSessionDelegate::InitializationResult( |