| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 private: | 57 private: |
| 58 // Schedule and execute periodic checks for re-sending packets. If no | 58 // Schedule and execute periodic checks for re-sending packets. If no |
| 59 // acknowledgements have been received for "too long," AudioSender will | 59 // acknowledgements have been received for "too long," AudioSender will |
| 60 // speculatively re-send certain packets of an unacked frame to kick-start | 60 // speculatively re-send certain packets of an unacked frame to kick-start |
| 61 // re-transmission. This is a last resort tactic to prevent the session from | 61 // re-transmission. This is a last resort tactic to prevent the session from |
| 62 // getting stuck after a long outage. | 62 // getting stuck after a long outage. |
| 63 void ScheduleNextResendCheck(); | 63 void ScheduleNextResendCheck(); |
| 64 void ResendCheck(); | 64 void ResendCheck(); |
| 65 void ResendForKickstart(); | 65 void ResendForKickstart(); |
| 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, or if the media |
| 68 // configured target playout delay plus simple logic. When this is true, | 68 // duration of the frames in flight would be too high by sending the next |
| 69 // InsertAudio() will silenty drop frames instead of sending them to the audio | 69 // frame. The latter metric is determined from the given |capture_time| |
| 70 // encoder. | 70 // for the next frame to be encoded and sent. |
| 71 bool AreTooManyFramesInFlight() const; | 71 bool ShouldDropNextFrame(base::TimeTicks capture_time) 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 // Encodes AudioBuses into EncodedFrames. | 76 // Encodes AudioBuses into EncodedFrames. |
| 77 scoped_ptr<AudioEncoder> audio_encoder_; | 77 scoped_ptr<AudioEncoder> audio_encoder_; |
| 78 const int configured_encoder_bitrate_; | 78 const int configured_encoder_bitrate_; |
| 79 | 79 |
| 80 // 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 |
| 81 // 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 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // NOTE: Weak pointers must be invalidated before all other member variables. | 113 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 114 base::WeakPtrFactory<AudioSender> weak_factory_; | 114 base::WeakPtrFactory<AudioSender> weak_factory_; |
| 115 | 115 |
| 116 DISALLOW_COPY_AND_ASSIGN(AudioSender); | 116 DISALLOW_COPY_AND_ASSIGN(AudioSender); |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 } // namespace cast | 119 } // namespace cast |
| 120 } // namespace media | 120 } // namespace media |
| 121 | 121 |
| 122 #endif // MEDIA_CAST_SENDER_AUDIO_SENDER_H_ | 122 #endif // MEDIA_CAST_SENDER_AUDIO_SENDER_H_ |
| OLD | NEW |