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

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

Issue 560223002: [Cast] Limit frames in flight by duration, and not by number of frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed auto-eviction from PacketStorage, since that should never happen. 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
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // sent, if AudioSender detects too many frames in flight. Therefore, clients 45 // sent, if AudioSender detects too many frames in flight. Therefore, clients
46 // should be careful about the rate at which this method is called. 46 // should be careful about the rate at which this method is called.
47 // 47 //
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 virtual int GetNumberOfFramesInEncoder() const OVERRIDE; 54 virtual int GetNumberOfFramesInEncoder() const OVERRIDE;
55 virtual base::TimeDelta GetInFlightMediaDuration() const OVERRIDE;
55 virtual void OnAck(uint32 frame_id) OVERRIDE; 56 virtual void OnAck(uint32 frame_id) OVERRIDE;
56 57
57 private: 58 private:
58 // Called by the |audio_encoder_| with the next EncodedFrame to send. 59 // Called by the |audio_encoder_| with the next EncodedFrame to send.
59 void OnEncodedAudioFrame(int encoder_bitrate, 60 void OnEncodedAudioFrame(int encoder_bitrate,
60 scoped_ptr<EncodedFrame> encoded_frame, 61 scoped_ptr<EncodedFrame> encoded_frame,
61 int samples_skipped); 62 int samples_skipped);
62 63
63 // Encodes AudioBuses into EncodedFrames. 64 // Encodes AudioBuses into EncodedFrames.
64 scoped_ptr<AudioEncoder> audio_encoder_; 65 scoped_ptr<AudioEncoder> audio_encoder_;
65 66
66 // The number of audio samples enqueued in |audio_encoder_|. 67 // The number of audio samples enqueued in |audio_encoder_|.
67 int samples_in_encoder_; 68 int samples_in_encoder_;
68 69
69 // NOTE: Weak pointers must be invalidated before all other member variables. 70 // NOTE: Weak pointers must be invalidated before all other member variables.
70 base::WeakPtrFactory<AudioSender> weak_factory_; 71 base::WeakPtrFactory<AudioSender> weak_factory_;
71 72
72 DISALLOW_COPY_AND_ASSIGN(AudioSender); 73 DISALLOW_COPY_AND_ASSIGN(AudioSender);
73 }; 74 };
74 75
75 } // namespace cast 76 } // namespace cast
76 } // namespace media 77 } // namespace media
77 78
78 #endif // MEDIA_CAST_SENDER_AUDIO_SENDER_H_ 79 #endif // MEDIA_CAST_SENDER_AUDIO_SENDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698