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

Unified Diff: media/cast/net/cast_transport.h

Issue 1878883003: Refactor: simplify interface of SenderRtcpSession and CastTransport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Created 4 years, 8 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/net/cast_transport.h
diff --git a/media/cast/net/cast_transport.h b/media/cast/net/cast_transport.h
index 953d61cdd4529575ea9260ab7e2b2dd221b91fd9..bbd949d29fa0c8823f07a7d2a5b6b9ee4e6f7dc9 100644
--- a/media/cast/net/cast_transport.h
+++ b/media/cast/net/cast_transport.h
@@ -21,7 +21,6 @@
#include <stdint.h>
#include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/non_thread_safe.h"
#include "base/time/tick_clock.h"
@@ -49,12 +48,30 @@ struct RtcpTimeData;
// Following the initialization of either audio or video an initialization
// status will be sent via this callback.
-typedef base::Callback<void(CastTransportStatus status)>
- CastTransportStatusCallback;
+using CastTransportStatusCallback =
+ base::Callback<void(CastTransportStatus status)>;
-typedef base::Callback<void(scoped_ptr<std::vector<FrameEvent>>,
- scoped_ptr<std::vector<PacketEvent>>)>
- BulkRawEventsCallback;
+using BulkRawEventsCallback =
+ base::Callback<void(std::unique_ptr<std::vector<FrameEvent>>,
+ std::unique_ptr<std::vector<PacketEvent>>)>;
+
+// Interface to handle received RTCP messages on RTP sender.
+class SenderRtcpObserver {
+ public:
+ virtual ~SenderRtcpObserver() {}
+
+ // Called on receiving cast message from RTP receiver.
+ virtual void OnCastMessageReceived(const RtcpCastMessage& cast_message) = 0;
+
+ // Called on receiving Rtt message from RTP receiver.
+ virtual void OnRttReceived(base::TimeDelta round_trip_time) = 0;
+
+ // Called on receiving PLI from RTP receiver.
+ virtual void OnPliReceived() = 0;
+
+ // Called on receiving RTP receiver logs.
+ virtual void OnReceiverLogReceived(const RtcpReceiverLogMessage& log){};
miu 2016/04/25 23:23:53 nit: space before {}
xjz 2016/04/29 19:15:49 Done.
+};
// The application should only trigger this class from the transport thread.
class CastTransport : public base::NonThreadSafe {
@@ -72,18 +89,18 @@ class CastTransport : public base::NonThreadSafe {
// the configured logging flush interval passed to
// CastTransport::Create().
virtual void OnLoggingEventsReceived(
- scoped_ptr<std::vector<FrameEvent>> frame_events,
- scoped_ptr<std::vector<PacketEvent>> packet_events) = 0;
+ std::unique_ptr<std::vector<FrameEvent>> frame_events,
+ std::unique_ptr<std::vector<PacketEvent>> packet_events) = 0;
// Called to pass RTP packets to the Client.
- virtual void ProcessRtpPacket(scoped_ptr<Packet> packet) = 0;
+ virtual void ProcessRtpPacket(std::unique_ptr<Packet> packet) = 0;
};
- static scoped_ptr<CastTransport> Create(
+ static std::unique_ptr<CastTransport> Create(
base::TickClock* clock, // Owned by the caller.
base::TimeDelta logging_flush_interval,
- scoped_ptr<Client> client,
- scoped_ptr<PacketTransport> transport,
+ std::unique_ptr<Client> client,
+ std::unique_ptr<PacketTransport> transport,
const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner);
virtual ~CastTransport() {}
@@ -91,14 +108,12 @@ class CastTransport : public base::NonThreadSafe {
// Audio/Video initialization.
// Encoded frames cannot be transmitted until the relevant initialize method
// is called.
- virtual void InitializeAudio(const CastTransportRtpConfig& config,
- const RtcpCastMessageCallback& cast_message_cb,
- const RtcpRttCallback& rtt_cb,
- const RtcpPliCallback& pli_cb) = 0;
- virtual void InitializeVideo(const CastTransportRtpConfig& config,
- const RtcpCastMessageCallback& cast_message_cb,
- const RtcpRttCallback& rtt_cb,
- const RtcpPliCallback& pli_cb) = 0;
+ virtual void InitializeAudio(
+ const CastTransportRtpConfig& config,
+ std::unique_ptr<SenderRtcpObserver> rtcp_observer) {}
+ virtual void InitializeVideo(
+ const CastTransportRtpConfig& config,
+ std::unique_ptr<SenderRtcpObserver> rtcp_observer) {}
// Encrypt, packetize and transmit |frame|. |ssrc| must refer to a
// a channel already established with InitializeAudio / InitializeVideo.

Powered by Google App Engine
This is Rietveld 408576698