diff options
Diffstat (limited to 'media/cast/test/sender.cc')
-rw-r--r-- | media/cast/test/sender.cc | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/media/cast/test/sender.cc b/media/cast/test/sender.cc index 206bfb5..fa508dc 100644 --- a/media/cast/test/sender.cc +++ b/media/cast/test/sender.cc @@ -160,6 +160,31 @@ void WriteStatsAndDestroySubscribers( VLOG(0) << "Audio stats: " << json; } +class TransportClient : public media::cast::CastTransportSender::Client { + public: + explicit TransportClient( + media::cast::LogEventDispatcher* log_event_dispatcher) + : log_event_dispatcher_(log_event_dispatcher) {} + + void OnStatusChanged(media::cast::CastTransportStatus status) final { + VLOG(1) << "Transport status: " << status; + }; + void OnLoggingEventsReceived( + scoped_ptr<std::vector<media::cast::FrameEvent>> frame_events, + scoped_ptr<std::vector<media::cast::PacketEvent>> packet_events) final { + DCHECK(log_event_dispatcher_); + log_event_dispatcher_->DispatchBatchOfEvents(std::move(frame_events), + std::move(packet_events)); + }; + void ProcessRtpPacket(scoped_ptr<media::cast::Packet> packet) final {} + + private: + media::cast::LogEventDispatcher* const + log_event_dispatcher_; // Not owned by this class. + + DISALLOW_COPY_AND_ASSIGN(TransportClient); +}; + } // namespace int main(int argc, char** argv) { @@ -235,14 +260,12 @@ int main(int argc, char** argv) { // CastTransportSender initialization. scoped_ptr<media::cast::CastTransportSender> transport_sender = media::cast::CastTransportSender::Create( - nullptr, // net log. - cast_environment->Clock(), net::IPEndPoint(), remote_endpoint, - make_scoped_ptr(new base::DictionaryValue), // options - base::Bind(&UpdateCastTransportStatus), - base::Bind(&media::cast::LogEventDispatcher::DispatchBatchOfEvents, - base::Unretained(cast_environment->logger())), - base::TimeDelta::FromSeconds(1), - media::cast::PacketReceiverCallback(), io_message_loop.task_runner()); + cast_environment->Clock(), base::TimeDelta::FromSeconds(1), + make_scoped_ptr(new TransportClient(cast_environment->logger())), + make_scoped_ptr(new media::cast::UdpTransport( + nullptr, io_message_loop.task_runner(), net::IPEndPoint(), + remote_endpoint, base::Bind(&UpdateCastTransportStatus))), + io_message_loop.task_runner()); // Set up event subscribers. scoped_ptr<media::cast::EncodingEventSubscriber> video_event_subscriber; |