| OLD | NEW |
| 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 #ifndef MEDIA_CAST_SENDER_AUDIO_SENDER_H_ | 5 #ifndef MEDIA_CAST_SENDER_AUDIO_SENDER_H_ |
| 6 #define MEDIA_CAST_SENDER_AUDIO_SENDER_H_ | 6 #define MEDIA_CAST_SENDER_AUDIO_SENDER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 // Returns true if there are too many frames in flight, as defined by the | 67 // Returns true if there are too many frames in flight, as defined by the |
| 68 // configured target playout delay plus simple logic. When this is true, | 68 // configured target playout delay plus simple logic. When this is true, |
| 69 // InsertAudio() will silenty drop frames instead of sending them to the audio | 69 // InsertAudio() will silenty drop frames instead of sending them to the audio |
| 70 // encoder. | 70 // encoder. |
| 71 bool AreTooManyFramesInFlight() const; | 71 bool AreTooManyFramesInFlight() const; |
| 72 | 72 |
| 73 // Called by the |audio_encoder_| with the next EncodedFrame to send. | 73 // Called by the |audio_encoder_| with the next EncodedFrame to send. |
| 74 void SendEncodedAudioFrame(scoped_ptr<EncodedFrame> audio_frame); | 74 void SendEncodedAudioFrame(scoped_ptr<EncodedFrame> audio_frame); |
| 75 | 75 |
| 76 // The total amount of time between a frame's capture/recording on the sender | |
| 77 // and its playback on the receiver (i.e., shown to a user). This is fixed as | |
| 78 // a value large enough to give the system sufficient time to encode, | |
| 79 // transmit/retransmit, receive, decode, and render; given its run-time | |
| 80 // environment (sender/receiver hardware performance, network conditions, | |
| 81 // etc.). | |
| 82 const base::TimeDelta target_playout_delay_; | |
| 83 | |
| 84 // Maximum number of outstanding frames before the encoding and sending of | |
| 85 // new frames shall halt. | |
| 86 const int max_unacked_frames_; | |
| 87 | |
| 88 // Encodes AudioBuses into EncodedFrames. | 76 // Encodes AudioBuses into EncodedFrames. |
| 89 scoped_ptr<AudioEncoder> audio_encoder_; | 77 scoped_ptr<AudioEncoder> audio_encoder_; |
| 90 const int configured_encoder_bitrate_; | 78 const int configured_encoder_bitrate_; |
| 91 | 79 |
| 92 // Counts how many RTCP reports are being "aggressively" sent (i.e., one per | 80 // Counts how many RTCP reports are being "aggressively" sent (i.e., one per |
| 93 // frame) at the start of the session. Once a threshold is reached, RTCP | 81 // frame) at the start of the session. Once a threshold is reached, RTCP |
| 94 // reports are instead sent at the configured interval + random drift. | 82 // reports are instead sent at the configured interval + random drift. |
| 95 int num_aggressive_rtcp_reports_sent_; | 83 int num_aggressive_rtcp_reports_sent_; |
| 96 | 84 |
| 97 // This is "null" until the first frame is sent. Thereafter, this tracks the | 85 // This is "null" until the first frame is sent. Thereafter, this tracks the |
| (...skipping 27 matching lines...) Expand all Loading... |
| 125 // NOTE: Weak pointers must be invalidated before all other member variables. | 113 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 126 base::WeakPtrFactory<AudioSender> weak_factory_; | 114 base::WeakPtrFactory<AudioSender> weak_factory_; |
| 127 | 115 |
| 128 DISALLOW_COPY_AND_ASSIGN(AudioSender); | 116 DISALLOW_COPY_AND_ASSIGN(AudioSender); |
| 129 }; | 117 }; |
| 130 | 118 |
| 131 } // namespace cast | 119 } // namespace cast |
| 132 } // namespace media | 120 } // namespace media |
| 133 | 121 |
| 134 #endif // MEDIA_CAST_SENDER_AUDIO_SENDER_H_ | 122 #endif // MEDIA_CAST_SENDER_AUDIO_SENDER_H_ |
| OLD | NEW |