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

Unified Diff: media/cast/sender/frame_sender.h

Issue 387933005: Cast: Refactor RTCP handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test 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
« no previous file with comments | « media/cast/sender/audio_sender_unittest.cc ('k') | media/cast/sender/frame_sender.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/sender/frame_sender.h
diff --git a/media/cast/sender/frame_sender.h b/media/cast/sender/frame_sender.h
new file mode 100644
index 0000000000000000000000000000000000000000..70eccba9ba7944051e1286b26bcf2587a2ad4f41
--- /dev/null
+++ b/media/cast/sender/frame_sender.h
@@ -0,0 +1,77 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// This is the base class for an object that send frames to a receiver.
+// TODO(hclam): Refactor such that there is no separate AudioSender vs.
+// VideoSender, and the functionality of both is rolled into this class.
+
+#ifndef MEDIA_CAST_SENDER_FRAME_SENDER_H_
+#define MEDIA_CAST_SENDER_FRAME_SENDER_H_
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
+#include "base/time/time.h"
+#include "media/cast/cast_environment.h"
+#include "media/cast/net/rtcp/rtcp.h"
+#include "media/cast/sender/rtp_timestamp_helper.h"
+
+namespace media {
+namespace cast {
+
+class FrameSender {
+ public:
+ FrameSender(scoped_refptr<CastEnvironment> cast_environment,
+ CastTransportSender* const transport_sender,
+ base::TimeDelta rtcp_interval,
+ int frequency,
+ uint32 ssrc);
+ virtual ~FrameSender();
+
+ protected:
+ // Schedule and execute periodic sending of RTCP report.
+ void ScheduleNextRtcpReport();
+ void SendRtcpReport(bool schedule_future_reports);
+
+ void OnReceivedRtt(base::TimeDelta rtt,
+ base::TimeDelta avg_rtt,
+ base::TimeDelta min_rtt,
+ base::TimeDelta max_rtt);
+
+ bool is_rtt_available() const { return rtt_available_; }
+
+ const scoped_refptr<CastEnvironment> cast_environment_;
+
+ // Sends encoded frames over the configured transport (e.g., UDP). In
+ // Chromium, this could be a proxy that first sends the frames from a renderer
+ // process to the browser process over IPC, with the browser process being
+ // responsible for "packetizing" the frames and pushing packets into the
+ // network layer.
+ CastTransportSender* const transport_sender_;
+
+ // Records lip-sync (i.e., mapping of RTP <--> NTP timestamps), and
+ // extrapolates this mapping to any other point in time.
+ RtpTimestampHelper rtp_timestamp_helper_;
+
+ // RTT information from RTCP.
+ bool rtt_available_;
+ base::TimeDelta rtt_;
+ base::TimeDelta avg_rtt_;
+ base::TimeDelta min_rtt_;
+ base::TimeDelta max_rtt_;
+
+ private:
+ const base::TimeDelta rtcp_interval_;
+ const uint32 ssrc_;
+
+ // NOTE: Weak pointers must be invalidated before all other member variables.
+ base::WeakPtrFactory<FrameSender> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(FrameSender);
+};
+
+} // namespace cast
+} // namespace media
+
+#endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_
« no previous file with comments | « media/cast/sender/audio_sender_unittest.cc ('k') | media/cast/sender/frame_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698