Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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 // This is the base class for an object that send frames to a receiver. | |
| 6 // TODO(hclam): Move AudioSender and VideoSender into this class. | |
|
miu
2014/07/16 19:58:03
nit: For clarity, could this TODO read as: Refacto
Alpha Left Google
2014/07/17 01:01:46
Done.
| |
| 7 | |
| 8 #ifndef MEDIA_CAST_SENDER_FRAME_SENDER_H_ | |
| 9 #define MEDIA_CAST_SENDER_FRAME_SENDER_H_ | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/memory/ref_counted.h" | |
| 13 #include "base/memory/weak_ptr.h" | |
| 14 #include "base/time/time.h" | |
| 15 #include "media/cast/cast_environment.h" | |
| 16 #include "media/cast/net/rtcp/rtcp.h" | |
| 17 #include "media/cast/sender/rtp_timestamp_helper.h" | |
| 18 | |
| 19 namespace media { | |
| 20 namespace cast { | |
| 21 | |
| 22 class FrameSender { | |
| 23 public: | |
| 24 FrameSender(scoped_refptr<CastEnvironment> cast_environment, | |
| 25 CastTransportSender* const transport_sender, | |
| 26 base::TimeDelta rtcp_interval, | |
| 27 int frequency, | |
| 28 bool is_audio); | |
| 29 virtual ~FrameSender(); | |
| 30 | |
| 31 protected: | |
| 32 // Schedule and execute periodic sending of RTCP report. | |
| 33 void ScheduleNextRtcpReport(); | |
| 34 void SendRtcpReport(bool schedule_future_reports); | |
| 35 | |
| 36 void OnReceivedRtt(base::TimeDelta rtt, | |
| 37 base::TimeDelta avg_rtt, | |
| 38 base::TimeDelta min_rtt, | |
| 39 base::TimeDelta max_rtt); | |
| 40 | |
| 41 bool is_rtt_available() const { return rtt_available_; } | |
| 42 | |
| 43 const scoped_refptr<CastEnvironment> cast_environment_; | |
| 44 | |
| 45 // Sends encoded frames over the configured transport (e.g., UDP). In | |
| 46 // Chromium, this could be a proxy that first sends the frames from a renderer | |
| 47 // process to the browser process over IPC, with the browser process being | |
| 48 // responsible for "packetizing" the frames and pushing packets into the | |
| 49 // network layer. | |
| 50 CastTransportSender* const transport_sender_; | |
| 51 | |
| 52 // Records lip-sync (i.e., mapping of RTP <--> NTP timestamps), and | |
| 53 // extrapolates this mapping to any other point in time. | |
| 54 RtpTimestampHelper rtp_timestamp_helper_; | |
| 55 | |
| 56 // RTT information from RTCP. | |
| 57 bool rtt_available_; | |
| 58 base::TimeDelta rtt_; | |
| 59 base::TimeDelta avg_rtt_; | |
| 60 base::TimeDelta min_rtt_; | |
| 61 base::TimeDelta max_rtt_; | |
| 62 | |
| 63 private: | |
| 64 const base::TimeDelta rtcp_interval_; | |
| 65 const bool is_audio_; | |
|
miu
2014/07/16 19:58:03
Could you add a TODO to remove this is_audio bool
Alpha Left Google
2014/07/17 01:01:46
Done.
miu
2014/07/18 00:06:22
Much better! :)
| |
| 66 | |
| 67 // NOTE: Weak pointers must be invalidated before all other member variables. | |
| 68 base::WeakPtrFactory<FrameSender> weak_factory_; | |
| 69 | |
| 70 DISALLOW_COPY_AND_ASSIGN(FrameSender); | |
| 71 }; | |
| 72 | |
| 73 } // namespace cast | |
| 74 } // namespace media | |
| 75 | |
| 76 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ | |
| OLD | NEW |