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

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

Issue 1498003003: Remove kint64max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: INT64_MAX 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
« no previous file with comments | « media/blink/websourcebuffer_impl.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 <stdint.h>
13
14 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
15 #include "base/time/time.h" 17 #include "base/time/time.h"
16 #include "media/cast/cast_environment.h" 18 #include "media/cast/cast_environment.h"
17 #include "media/cast/net/rtcp/rtcp.h" 19 #include "media/cast/net/rtcp/rtcp.h"
18 #include "media/cast/sender/congestion_control.h" 20 #include "media/cast/sender/congestion_control.h"
19 21
20 namespace media { 22 namespace media {
21 namespace cast { 23 namespace cast {
22 24
23 struct SenderEncodedFrame; 25 struct SenderEncodedFrame;
24 26
25 class FrameSender { 27 class FrameSender {
26 public: 28 public:
27 FrameSender(scoped_refptr<CastEnvironment> cast_environment, 29 FrameSender(scoped_refptr<CastEnvironment> cast_environment,
28 bool is_audio, 30 bool is_audio,
29 CastTransportSender* const transport_sender, 31 CastTransportSender* const transport_sender,
30 int rtp_timebase, 32 int rtp_timebase,
31 uint32 ssrc, 33 uint32_t ssrc,
32 double max_frame_rate, 34 double max_frame_rate,
33 base::TimeDelta min_playout_delay, 35 base::TimeDelta min_playout_delay,
34 base::TimeDelta max_playout_delay, 36 base::TimeDelta max_playout_delay,
35 CongestionControl* congestion_control); 37 CongestionControl* congestion_control);
36 virtual ~FrameSender(); 38 virtual ~FrameSender();
37 39
38 int rtp_timebase() const { return rtp_timebase_; } 40 int rtp_timebase() const { return rtp_timebase_; }
39 41
40 // Calling this function is only valid if the receiver supports the 42 // Calling this function is only valid if the receiver supports the
41 // "extra_playout_delay", rtp extension. 43 // "extra_playout_delay", rtp extension.
(...skipping 24 matching lines...) Expand all
66 68
67 const scoped_refptr<CastEnvironment> cast_environment_; 69 const scoped_refptr<CastEnvironment> cast_environment_;
68 70
69 // Sends encoded frames over the configured transport (e.g., UDP). In 71 // Sends encoded frames over the configured transport (e.g., UDP). In
70 // Chromium, this could be a proxy that first sends the frames from a renderer 72 // Chromium, this could be a proxy that first sends the frames from a renderer
71 // process to the browser process over IPC, with the browser process being 73 // process to the browser process over IPC, with the browser process being
72 // responsible for "packetizing" the frames and pushing packets into the 74 // responsible for "packetizing" the frames and pushing packets into the
73 // network layer. 75 // network layer.
74 CastTransportSender* const transport_sender_; 76 CastTransportSender* const transport_sender_;
75 77
76 const uint32 ssrc_; 78 const uint32_t ssrc_;
77 79
78 protected: 80 protected:
79 // Schedule and execute periodic checks for re-sending packets. If no 81 // Schedule and execute periodic checks for re-sending packets. If no
80 // acknowledgements have been received for "too long," AudioSender will 82 // acknowledgements have been received for "too long," AudioSender will
81 // speculatively re-send certain packets of an unacked frame to kick-start 83 // speculatively re-send certain packets of an unacked frame to kick-start
82 // re-transmission. This is a last resort tactic to prevent the session from 84 // re-transmission. This is a last resort tactic to prevent the session from
83 // getting stuck after a long outage. 85 // getting stuck after a long outage.
84 void ScheduleNextResendCheck(); 86 void ScheduleNextResendCheck();
85 void ResendCheck(); 87 void ResendCheck();
86 void ResendForKickstart(); 88 void ResendForKickstart();
87 89
88 // Protected for testability. 90 // Protected for testability.
89 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback); 91 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback);
90 92
91 // Returns true if too many frames would be in-flight by encoding and sending 93 // Returns true if too many frames would be in-flight by encoding and sending
92 // the next frame having the given |frame_duration|. 94 // the next frame having the given |frame_duration|.
93 bool ShouldDropNextFrame(base::TimeDelta frame_duration) const; 95 bool ShouldDropNextFrame(base::TimeDelta frame_duration) const;
94 96
95 // Record or retrieve a recent history of each frame's timestamps. 97 // Record or retrieve a recent history of each frame's timestamps.
96 // Warning: If a frame ID too far in the past is requested, the getters will 98 // Warning: If a frame ID too far in the past is requested, the getters will
97 // silently succeed but return incorrect values. Be sure to respect 99 // silently succeed but return incorrect values. Be sure to respect
98 // media::cast::kMaxUnackedFrames. 100 // media::cast::kMaxUnackedFrames.
99 void RecordLatestFrameTimestamps(uint32 frame_id, 101 void RecordLatestFrameTimestamps(uint32_t frame_id,
100 base::TimeTicks reference_time, 102 base::TimeTicks reference_time,
101 RtpTimestamp rtp_timestamp); 103 RtpTimestamp rtp_timestamp);
102 base::TimeTicks GetRecordedReferenceTime(uint32 frame_id) const; 104 base::TimeTicks GetRecordedReferenceTime(uint32_t frame_id) const;
103 RtpTimestamp GetRecordedRtpTimestamp(uint32 frame_id) const; 105 RtpTimestamp GetRecordedRtpTimestamp(uint32_t frame_id) const;
104 106
105 // Returns the number of frames that were sent but not yet acknowledged. 107 // Returns the number of frames that were sent but not yet acknowledged.
106 int GetUnacknowledgedFrameCount() const; 108 int GetUnacknowledgedFrameCount() const;
107 109
108 // The total amount of time between a frame's capture/recording on the sender 110 // The total amount of time between a frame's capture/recording on the sender
109 // and its playback on the receiver (i.e., shown to a user). This is fixed as 111 // and its playback on the receiver (i.e., shown to a user). This is fixed as
110 // a value large enough to give the system sufficient time to encode, 112 // a value large enough to give the system sufficient time to encode,
111 // transmit/retransmit, receive, decode, and render; given its run-time 113 // transmit/retransmit, receive, decode, and render; given its run-time
112 // environment (sender/receiver hardware performance, network conditions, 114 // environment (sender/receiver hardware performance, network conditions,
113 // etc.). 115 // etc.).
(...skipping 12 matching lines...) Expand all
126 // reports are instead sent at the configured interval + random drift. 128 // reports are instead sent at the configured interval + random drift.
127 int num_aggressive_rtcp_reports_sent_; 129 int num_aggressive_rtcp_reports_sent_;
128 130
129 // This is "null" until the first frame is sent. Thereafter, this tracks the 131 // This is "null" until the first frame is sent. Thereafter, this tracks the
130 // last time any frame was sent or re-sent. 132 // last time any frame was sent or re-sent.
131 base::TimeTicks last_send_time_; 133 base::TimeTicks last_send_time_;
132 134
133 // The ID of the last frame sent. Logic throughout FrameSender assumes this 135 // The ID of the last frame sent. Logic throughout FrameSender assumes this
134 // can safely wrap-around. This member is invalid until 136 // can safely wrap-around. This member is invalid until
135 // |!last_send_time_.is_null()|. 137 // |!last_send_time_.is_null()|.
136 uint32 last_sent_frame_id_; 138 uint32_t last_sent_frame_id_;
137 139
138 // The ID of the latest (not necessarily the last) frame that has been 140 // The ID of the latest (not necessarily the last) frame that has been
139 // acknowledged. Logic throughout AudioSender assumes this can safely 141 // acknowledged. Logic throughout AudioSender assumes this can safely
140 // wrap-around. This member is invalid until |!last_send_time_.is_null()|. 142 // wrap-around. This member is invalid until |!last_send_time_.is_null()|.
141 uint32 latest_acked_frame_id_; 143 uint32_t latest_acked_frame_id_;
142 144
143 // Counts the number of duplicate ACK that are being received. When this 145 // Counts the number of duplicate ACK that are being received. When this
144 // number reaches a threshold, the sender will take this as a sign that the 146 // number reaches a threshold, the sender will take this as a sign that the
145 // receiver hasn't yet received the first packet of the next frame. In this 147 // receiver hasn't yet received the first packet of the next frame. In this
146 // case, VideoSender will trigger a re-send of the next frame. 148 // case, VideoSender will trigger a re-send of the next frame.
147 int duplicate_ack_counter_; 149 int duplicate_ack_counter_;
148 150
149 // This object controls how we change the bitrate to make sure the 151 // This object controls how we change the bitrate to make sure the
150 // buffer doesn't overflow. 152 // buffer doesn't overflow.
151 scoped_ptr<CongestionControl> congestion_control_; 153 scoped_ptr<CongestionControl> congestion_control_;
(...skipping 20 matching lines...) Expand all
172 // NOTE: Weak pointers must be invalidated before all other member variables. 174 // NOTE: Weak pointers must be invalidated before all other member variables.
173 base::WeakPtrFactory<FrameSender> weak_factory_; 175 base::WeakPtrFactory<FrameSender> weak_factory_;
174 176
175 DISALLOW_COPY_AND_ASSIGN(FrameSender); 177 DISALLOW_COPY_AND_ASSIGN(FrameSender);
176 }; 178 };
177 179
178 } // namespace cast 180 } // namespace cast
179 } // namespace media 181 } // namespace media
180 182
181 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_ 183 #endif // MEDIA_CAST_SENDER_FRAME_SENDER_H_
OLDNEW
« no previous file with comments | « media/blink/websourcebuffer_impl.cc ('k') | media/cast/sender/frame_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698