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

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

Issue 502333002: [Cast] In Audio/VideoSender, drop frames when too-long a duration is in-flight. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix missing brace (rebase oops). 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/cast_defines.h ('k') | media/cast/sender/audio_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 #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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // Note: It is invalid to call this method if InitializationResult() returns 48 // Note: It is invalid to call this method if InitializationResult() returns
49 // anything but STATUS_AUDIO_INITIALIZED. 49 // anything but STATUS_AUDIO_INITIALIZED.
50 void InsertAudio(scoped_ptr<AudioBus> audio_bus, 50 void InsertAudio(scoped_ptr<AudioBus> audio_bus,
51 const base::TimeTicks& recorded_time); 51 const base::TimeTicks& recorded_time);
52 52
53 protected: 53 protected:
54 // Protected for testability. 54 // Protected for testability.
55 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback); 55 void OnReceivedCastFeedback(const RtcpCastMessage& cast_feedback);
56 56
57 private: 57 private:
58 // Returns true if there are too many frames in flight, as defined by the 58 // Returns true if there are too many frames in flight, or if the media
59 // configured target playout delay plus simple logic. When this is true, 59 // duration of the frames in flight would be too high by sending the next
60 // InsertAudio() will silenty drop frames instead of sending them to the audio 60 // frame. The latter metric is determined from the given |capture_time|
61 // encoder. 61 // for the next frame to be encoded and sent.
62 bool AreTooManyFramesInFlight() const; 62 bool ShouldDropNextFrame(base::TimeTicks capture_time) const;
63 63
64 // Called by the |audio_encoder_| with the next EncodedFrame to send. 64 // Called by the |audio_encoder_| with the next EncodedFrame to send.
65 void SendEncodedAudioFrame(scoped_ptr<EncodedFrame> audio_frame); 65 void SendEncodedAudioFrame(scoped_ptr<EncodedFrame> audio_frame);
66 66
67 // Encodes AudioBuses into EncodedFrames. 67 // Encodes AudioBuses into EncodedFrames.
68 scoped_ptr<AudioEncoder> audio_encoder_; 68 scoped_ptr<AudioEncoder> audio_encoder_;
69 const int configured_encoder_bitrate_; 69 const int configured_encoder_bitrate_;
70 70
71 // NOTE: Weak pointers must be invalidated before all other member variables. 71 // NOTE: Weak pointers must be invalidated before all other member variables.
72 base::WeakPtrFactory<AudioSender> weak_factory_; 72 base::WeakPtrFactory<AudioSender> weak_factory_;
73 73
74 DISALLOW_COPY_AND_ASSIGN(AudioSender); 74 DISALLOW_COPY_AND_ASSIGN(AudioSender);
75 }; 75 };
76 76
77 } // namespace cast 77 } // namespace cast
78 } // namespace media 78 } // namespace media
79 79
80 #endif // MEDIA_CAST_SENDER_AUDIO_SENDER_H_ 80 #endif // MEDIA_CAST_SENDER_AUDIO_SENDER_H_
OLDNEW
« no previous file with comments | « media/cast/cast_defines.h ('k') | media/cast/sender/audio_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698