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

Unified Diff: media/cast/test/utility/in_process_receiver.cc

Issue 1515023002: Simplify interface for media/cast: CastTransportSenderImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add changes on tests. Created 4 years, 11 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: media/cast/test/utility/in_process_receiver.cc
diff --git a/media/cast/test/utility/in_process_receiver.cc b/media/cast/test/utility/in_process_receiver.cc
index 1e97c9ab116a5b49d6a9816cf824973655806cbc..679251ff8291e0098381ead552d785501de52878 100644
--- a/media/cast/test/utility/in_process_receiver.cc
+++ b/media/cast/test/utility/in_process_receiver.cc
@@ -23,6 +23,33 @@ using media::cast::UdpTransport;
namespace media {
namespace cast {
+namespace {
+class TransportClient : public CastTransportSender::Client {
+ public:
+ TransportClient(InProcessReceiver* in_process_receiver)
miu 2016/02/22 22:38:48 Need 'explicit' keyword here.
xjz 2016/02/23 21:51:47 Done.
+ : in_process_receiver_(in_process_receiver) {}
+
+ void OnStatusChanged(CastTransportStatus status) final {
+ LOG_IF(ERROR, status == media::cast::TRANSPORT_SOCKET_ERROR)
+ << "Transport socket error occurred. InProcessReceiver is likely "
+ "dead.";
+ VLOG(1) << "CastTransportStatus is now " << status;
+ };
+ void OnLoggingEventsReceived(
+ scoped_ptr<std::vector<FrameEvent>> frame_events,
+ scoped_ptr<std::vector<PacketEvent>> packet_events) final{};
+ void ProcessRtpPacket(scoped_ptr<Packet> packet) final {
+ in_process_receiver_->ReceivePacket(std::move(packet));
+ };
+
+ private:
+ InProcessReceiver* const in_process_receiver_;
+
+ DISALLOW_COPY_AND_ASSIGN(TransportClient);
+};
+
+} // namespace
+
InProcessReceiver::InProcessReceiver(
const scoped_refptr<CastEnvironment>& cast_environment,
const net::IPEndPoint& local_end_point,
@@ -81,17 +108,13 @@ void InProcessReceiver::StartOnMainThread() {
DCHECK(!transport_ && !cast_receiver_);
transport_ = CastTransportSender::Create(
- NULL,
- cast_environment_->Clock(),
- local_end_point_,
- remote_end_point_,
- scoped_ptr<base::DictionaryValue>(new base::DictionaryValue),
- base::Bind(&InProcessReceiver::UpdateCastTransportStatus,
- base::Unretained(this)),
- BulkRawEventsCallback(),
- base::TimeDelta(),
- base::Bind(&InProcessReceiver::ReceivePacket,
- base::Unretained(this)),
+ cast_environment_->Clock(), base::TimeDelta(),
+ make_scoped_ptr(new TransportClient(this)),
+ make_scoped_ptr(new UdpTransport(
+ NULL, cast_environment_->GetTaskRunner(CastEnvironment::MAIN),
miu 2016/02/22 22:38:48 nit: Please change NULLs to nullptr whenever you c
xjz 2016/02/23 21:51:47 Done.
+ local_end_point_, remote_end_point_,
+ base::Bind(&InProcessReceiver::UpdateCastTransportStatus,
+ base::Unretained(this)))),
cast_environment_->GetTaskRunner(CastEnvironment::MAIN));
cast_receiver_ = CastReceiver::Create(

Powered by Google App Engine
This is Rietveld 408576698