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

Side by Side Diff: media/cast/net/rtcp/receiver_rtcp_session.h

Issue 1520613004: cast: Split Rtcp into two for sender and receiver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@timestamp
Patch Set: Created 5 years 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_CAST_NET_RTCP_RECEIVER_RTCP_SESSION_H_
6 #define MEDIA_CAST_NET_RTCP_RECEIVER_RTCP_SESSION_H_
7
8 #include "base/time/tick_clock.h"
9 #include "media/cast/common/clock_drift_smoother.h"
10 #include "media/cast/net/pacing/paced_sender.h"
11 #include "media/cast/net/rtcp/receiver_rtcp_event_subscriber.h"
12 #include "media/cast/net/rtcp/receiver_rtcp_session.h"
13 #include "media/cast/net/rtcp/rtcp_defines.h"
14 #include "media/cast/net/rtcp/rtcp_session.h"
15 #include "media/cast/net/rtcp/rtcp_utility.h"
16
17 namespace media {
18 namespace cast {
19
20 class ReceiverRtcpSession : public RtcpSession {
xjz 2015/12/11 18:02:47 Where is RtcpSession defined? Did you forget "rtcp
Irfan 2015/12/11 18:42:56 Thanks for catching. Added now.
21 public:
22 ReceiverRtcpSession(base::TickClock* clock, // Not owned.
23 PacedPacketSender* packet_sender, // Not owned.
24 uint32_t local_ssrc,
25 uint32_t remote_ssrc);
26
27 ~ReceiverRtcpSession() override;
28
29 uint32_t local_ssrc() const { return local_ssrc_; }
30 uint32_t remote_ssrc() const { return remote_ssrc_; }
31
32 // |cast_message|, |rtcp_events| and |rtp_receiver_statistics| are optional;
33 // if |cast_message| is provided the RTCP receiver report will append a Cast
34 // message containing Acks and Nacks; |target_delay| is sent together with
35 // |cast_message|. If |rtcp_events| is provided the RTCP receiver report will
36 // append the log messages.
37 void SendRtcpReport(
38 RtcpTimeData time_data,
39 const RtcpCastMessage* cast_message,
40 base::TimeDelta target_delay,
41 const ReceiverRtcpEventSubscriber::RtcpEvents* rtcp_events,
42 const RtpReceiverStatistics* rtp_receiver_statistics) const;
43
44 // Handle incoming RTCP packet.
45 // Returns false if it is not a RTCP packet or it is not directed to
46 // this session, e.g. SSRC doesn't match.
47 bool IncomingRtcpPacket(const uint8* data, size_t length) override;
48
49 // If available, returns true and sets the output arguments to the latest
50 // lip-sync timestamps gleaned from the sender reports. While the sender
51 // provides reference NTP times relative to its own wall clock, the
52 // |reference_time| returned here has been translated to the local
53 // CastEnvironment clock.
54 bool GetLatestLipSyncTimes(RtpTimeTicks* rtp_timestamp,
55 base::TimeTicks* reference_time) const;
56
57 private:
58 void OnReceivedNtp(uint32_t ntp_seconds, uint32_t ntp_fraction);
59
60 void OnReceivedLipSyncInfo(RtpTimeTicks rtp_timestamp,
61 uint32_t ntp_seconds,
62 uint32_t ntp_fraction);
63
64 base::TickClock* const clock_; // Not owned.
65 PacedPacketSender* packet_sender_; // Not owned.
66 const uint32_t local_ssrc_;
67 const uint32_t remote_ssrc_;
68
69 // The truncated (i.e., 64-->32-bit) NTP timestamp provided in the last report
70 // from the remote peer, along with the local time at which the report was
71 // received. These values are used for ping-pong'ing NTP timestamps between
72 // the peers so that they can estimate the network's round-trip time.
73 uint32_t last_report_truncated_ntp_;
74 base::TimeTicks time_last_report_received_;
75
76 // Maintains a smoothed offset between the local clock and the remote clock.
77 // Calling this member's Current() method is only valid if
78 // |time_last_report_received_| has a valid value.
79 ClockDriftSmoother local_clock_ahead_by_;
80
81 // Latest "lip sync" info from the sender. The sender provides the RTP
82 // timestamp of some frame of its choosing and also a corresponding reference
83 // NTP timestamp sampled from a clock common to all media streams. It is
84 // expected that the sender will update this data regularly and in a timely
85 // manner (e.g., about once per second).
86 RtpTimeTicks lip_sync_rtp_timestamp_;
87 uint64_t lip_sync_ntp_timestamp_;
88
89 RtcpParser parser_;
90
91 DISALLOW_COPY_AND_ASSIGN(ReceiverRtcpSession);
92 };
93
94 } // namespace cast
95 } // namespace media
96
97 #endif // MEDIA_CAST_NET_RTCP_RECEIVER_RTCP_SESSION_H_
OLDNEW
« no previous file with comments | « media/cast/net/cast_transport_sender_impl_unittest.cc ('k') | media/cast/net/rtcp/receiver_rtcp_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698