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

Side by Side Diff: media/cast/sender/frame_sender.h

Issue 493823002: Implement adaptive target delay extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: explicit masking Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « media/cast/sender/audio_sender.cc ('k') | media/cast/sender/frame_sender.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This is the base class for an object that send frames to a receiver. 5 // This is the base class for an object that send frames to a receiver.
6 // TODO(hclam): Refactor such that there is no separate AudioSender vs. 6 // TODO(hclam): Refactor such that there is no separate AudioSender vs.
7 // VideoSender, and the functionality of both is rolled into this class. 7 // VideoSender, and the functionality of both is rolled into this class.
8 8
9 #ifndef MEDIA_CAST_SENDER_FRAME_SENDER_H_ 9 #ifndef MEDIA_CAST_SENDER_FRAME_SENDER_H_
10 #define MEDIA_CAST_SENDER_FRAME_SENDER_H_ 10 #define MEDIA_CAST_SENDER_FRAME_SENDER_H_
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "media/cast/cast_environment.h" 16 #include "media/cast/cast_environment.h"
17 #include "media/cast/net/rtcp/rtcp.h" 17 #include "media/cast/net/rtcp/rtcp.h"
18 #include "media/cast/sender/rtp_timestamp_helper.h" 18 #include "media/cast/sender/rtp_timestamp_helper.h"
19 19
20 namespace media { 20 namespace media {
21 namespace cast { 21 namespace cast {
22 22
23 class FrameSender { 23 class FrameSender {
24 public: 24 public:
25 FrameSender(scoped_refptr<CastEnvironment> cast_environment, 25 FrameSender(scoped_refptr<CastEnvironment> cast_environment,
26 CastTransportSender* const transport_sender, 26 CastTransportSender* const transport_sender,
27 base::TimeDelta rtcp_interval, 27 base::TimeDelta rtcp_interval,
28 int frequency, 28 int frequency,
29 uint32 ssrc); 29 uint32 ssrc,
30 double max_frame_rate,
31 base::TimeDelta playout_delay);
30 virtual ~FrameSender(); 32 virtual ~FrameSender();
31 33
34 // Calling this function is only valid if the receiver supports the
35 // "extra_playout_delay", rtp extension.
36 void SetTargetPlayoutDelay(base::TimeDelta new_target_playout_delay);
37
38 base::TimeDelta GetTargetPlayoutDelay() const {
39 return target_playout_delay_;
40 }
41
32 protected: 42 protected:
33 // Schedule and execute periodic sending of RTCP report. 43 // Schedule and execute periodic sending of RTCP report.
34 void ScheduleNextRtcpReport(); 44 void ScheduleNextRtcpReport();
35 void SendRtcpReport(bool schedule_future_reports); 45 void SendRtcpReport(bool schedule_future_reports);
36 46
37 void OnReceivedRtt(base::TimeDelta rtt, 47 void OnReceivedRtt(base::TimeDelta rtt,
38 base::TimeDelta avg_rtt, 48 base::TimeDelta avg_rtt,
39 base::TimeDelta min_rtt, 49 base::TimeDelta min_rtt,
40 base::TimeDelta max_rtt); 50 base::TimeDelta max_rtt);
41 51
(...skipping 14 matching lines...) Expand all
56 // extrapolates this mapping to any other point in time. 66 // extrapolates this mapping to any other point in time.
57 RtpTimestampHelper rtp_timestamp_helper_; 67 RtpTimestampHelper rtp_timestamp_helper_;
58 68
59 // RTT information from RTCP. 69 // RTT information from RTCP.
60 bool rtt_available_; 70 bool rtt_available_;
61 base::TimeDelta rtt_; 71 base::TimeDelta rtt_;
62 base::TimeDelta avg_rtt_; 72 base::TimeDelta avg_rtt_;
63 base::TimeDelta min_rtt_; 73 base::TimeDelta min_rtt_;
64 base::TimeDelta max_rtt_; 74 base::TimeDelta max_rtt_;
65 75
66 private: 76 protected:
67 const base::TimeDelta rtcp_interval_; 77 const base::TimeDelta rtcp_interval_;
68 78
79 // The total amount of time between a frame's capture/recording on the sender
80 // and its playback on the receiver (i.e., shown to a user). This is fixed as
81 // a value large enough to give the system sufficient time to encode,
82 // transmit/retransmit, receive, decode, and render; given its run-time
83 // environment (sender/receiver hardware performance, network conditions,
84 // etc.).
85 base::TimeDelta target_playout_delay_;
86
87 // If true, we transmit the target playout delay to the receiver.
88 bool send_target_playout_delay_;
89
90 // Max encoded frames generated per second.
91 double max_frame_rate_;
92
93 // Maximum number of outstanding frames before the encoding and sending of
94 // new frames shall halt.
95 int max_unacked_frames_;
96
97 private:
69 // NOTE: Weak pointers must be invalidated before all other member variables. 98 // NOTE: Weak pointers must be invalidated before all other member variables.
70 base::WeakPtrFactory<FrameSender> weak_factory_; 99 base::WeakPtrFactory<FrameSender> weak_factory_;
71 100
72 DISALLOW_COPY_AND_ASSIGN(FrameSender); 101 DISALLOW_COPY_AND_ASSIGN(FrameSender);
73 }; 102 };
74 103
75 } // namespace cast 104 } // namespace cast
76 } // namespace media 105 } // namespace media
77 106
78 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ 107 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_
OLDNEW
« no previous file with comments | « media/cast/sender/audio_sender.cc ('k') | media/cast/sender/frame_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698