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

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

Issue 387933005: Cast: Refactor RTCP handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: smaller diff Created 6 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: media/cast/net/cast_transport_sender.h
diff --git a/media/cast/net/cast_transport_sender.h b/media/cast/net/cast_transport_sender.h
index bbc87aaca6173b11c7927f396b89d9a64bbb9dac..4c8e3bcfb760a0588a51d85959ccaf65d3aebc66 100644
--- a/media/cast/net/cast_transport_sender.h
+++ b/media/cast/net/cast_transport_sender.h
@@ -10,15 +10,10 @@
// in the following order:
// 1. Create CastTransportSender.
// 2. Create CastSender (accepts CastTransportSender as an input).
-// 3. Call CastTransportSender::SetPacketReceiver to ensure that the packets
-// received by the CastTransportSender will be sent to the CastSender.
-// Steps 3 can be done interchangeably.
// Destruction: The CastTransportSender is assumed to be valid as long as the
// CastSender is alive. Therefore the CastSender should be destructed before the
// CastTransportSender.
-// This also works when the CastSender acts as a receiver for the RTCP packets
-// due to the weak pointers in the ReceivedPacket method in cast_sender_impl.cc.
#ifndef MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_
#define MEDIA_CAST_NET_CAST_TRANSPORT_SENDER_H_
@@ -31,6 +26,8 @@
#include "media/cast/logging/logging_defines.h"
#include "media/cast/net/cast_transport_config.h"
#include "media/cast/net/cast_transport_defines.h"
+#include "media/cast/net/rtcp/receiver_rtcp_event_subscriber.h"
+#include "media/cast/net/rtcp/rtcp_defines.h"
namespace net {
class NetLog;
@@ -44,7 +41,8 @@ namespace cast {
typedef base::Callback<void(CastTransportStatus status)>
CastTransportStatusCallback;
-typedef base::Callback<void(const std::vector<PacketEvent>&)>
+typedef base::Callback<void(const std::vector<PacketEvent>&,
+ const std::vector<FrameEvent>&)>
BulkRawEventsCallback;
// The application should only trigger this class from the transport thread.
@@ -63,14 +61,13 @@ class CastTransportSender : public base::NonThreadSafe {
// Audio/Video initialization.
// Encoded frames cannot be transmitted until the relevant initialize method
- // is called. Usually called by CastSender.
- virtual void InitializeAudio(const CastTransportRtpConfig& config) = 0;
- virtual void InitializeVideo(const CastTransportRtpConfig& config) = 0;
-
- // Sets the Cast packet receiver. Should be called after creation on the
- // Cast sender. Packets won't be received until this function is called.
- virtual void SetPacketReceiver(
- const PacketReceiverCallback& packet_receiver) = 0;
+ // is called.
+ virtual void InitializeAudio(const CastTransportRtpConfig& config,
+ const RtcpCastMessageCallback& cast_message_cb,
+ const RtcpRttCallback& rtt_cb) = 0;
+ virtual void InitializeVideo(const CastTransportRtpConfig& config,
+ const RtcpCastMessageCallback& cast_message_cb,
+ const RtcpRttCallback& rtt_cb) = 0;
// The following two functions handle the encoded media frames (audio and
// video) to be processed.
@@ -78,16 +75,14 @@ class CastTransportSender : public base::NonThreadSafe {
virtual void InsertCodedAudioFrame(const EncodedFrame& audio_frame) = 0;
virtual void InsertCodedVideoFrame(const EncodedFrame& video_frame) = 0;
- // Builds an RTCP packet and sends it to the network.
- // |ntp_seconds|, |ntp_fraction| and |rtp_timestamp| are used in the
- // RTCP Sender Report.
- virtual void SendRtcpFromRtpSender(uint32 packet_type_flags,
- uint32 ntp_seconds,
- uint32 ntp_fraction,
- uint32 rtp_timestamp,
- const RtcpDlrrReportBlock& dlrr,
- uint32 sending_ssrc,
- const std::string& c_name) = 0;
+ // Sends a RTCP sender report to the receiver.
+ // |audio| is true of this is for audio stream. False otherwise.
+ // |current_time| is the current time reported by a tick clock.
+ // |current_time_as_rtp_timestamp| is the corresponding RTP timestamp.
+ virtual void SendRtcpFromRtpSender(
miu 2014/07/16 00:09:30 Can we name this SendSenderReport instead? Or, ev
Alpha Left Google 2014/07/17 01:01:43 Let's use the RTCP terminology of "SenderReport".
+ bool audio,
+ base::TimeTicks current_time,
+ uint32 current_time_as_rtp_timestamp) = 0;
// Retransmission request.
// |missing_packets| includes the list of frames and packets in each
@@ -102,6 +97,9 @@ class CastTransportSender : public base::NonThreadSafe {
const MissingFramesAndPacketsMap& missing_packets,
bool cancel_rtx_if_not_in_list,
base::TimeDelta dedupe_window) = 0;
+
+ // Returns a callback for receiving packets for testing purposes.
+ virtual PacketReceiverCallback PacketReceiverForTesting() = 0;
};
} // namespace cast

Powered by Google App Engine
This is Rietveld 408576698