OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ | 5 #ifndef MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ |
6 #define MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ | 6 #define MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // the sender, then receive and re-order packets on the receiver, then decode | 40 // the sender, then receive and re-order packets on the receiver, then decode |
41 // frame) can vary in duration and is typically very hard to predict. | 41 // frame) can vary in duration and is typically very hard to predict. |
42 // Heuristics will determine when the targeted playout delay is insufficient in | 42 // Heuristics will determine when the targeted playout delay is insufficient in |
43 // the current environment; and the receiver can then increase the playout | 43 // the current environment; and the receiver can then increase the playout |
44 // delay, notifying the sender, to account for the extra variance. | 44 // delay, notifying the sender, to account for the extra variance. |
45 // TODO(miu): Make the last sentence true. http://crbug.com/360111 | 45 // TODO(miu): Make the last sentence true. http://crbug.com/360111 |
46 // | 46 // |
47 // Two types of frames can be requested: 1) A frame of decoded audio data; or 2) | 47 // Two types of frames can be requested: 1) A frame of decoded audio data; or 2) |
48 // a frame of still-encoded audio data, to be passed into an external audio | 48 // a frame of still-encoded audio data, to be passed into an external audio |
49 // decoder. Each request for a frame includes a callback which AudioReceiver | 49 // decoder. Each request for a frame includes a callback which AudioReceiver |
50 // guarantees will be called at some point in the future. Clients should | 50 // guarantees will be called at some point in the future unless the |
51 // generally limit the number of outstanding requests (perhaps to just one or | 51 // AudioReceiver is destroyed. Clients should generally limit the number of |
52 // two). When AudioReceiver is destroyed, any outstanding requests will be | 52 // outstanding requests (perhaps to just one or two). |
53 // immediately invoked with a NULL frame. | |
54 // | 53 // |
55 // This class is not thread safe. Should only be called from the Main cast | 54 // This class is not thread safe. Should only be called from the Main cast |
56 // thread. | 55 // thread. |
57 class AudioReceiver : public RtpReceiver, | 56 class AudioReceiver : public RtpReceiver, |
58 public RtpPayloadFeedback, | 57 public RtpPayloadFeedback, |
59 public base::NonThreadSafe, | 58 public base::NonThreadSafe, |
60 public base::SupportsWeakPtr<AudioReceiver> { | 59 public base::SupportsWeakPtr<AudioReceiver> { |
61 public: | 60 public: |
62 AudioReceiver(scoped_refptr<CastEnvironment> cast_environment, | 61 AudioReceiver(scoped_refptr<CastEnvironment> cast_environment, |
63 const AudioReceiverConfig& audio_config, | 62 const AudioReceiverConfig& audio_config, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // NOTE: Weak pointers must be invalidated before all other member variables. | 175 // NOTE: Weak pointers must be invalidated before all other member variables. |
177 base::WeakPtrFactory<AudioReceiver> weak_factory_; | 176 base::WeakPtrFactory<AudioReceiver> weak_factory_; |
178 | 177 |
179 DISALLOW_COPY_AND_ASSIGN(AudioReceiver); | 178 DISALLOW_COPY_AND_ASSIGN(AudioReceiver); |
180 }; | 179 }; |
181 | 180 |
182 } // namespace cast | 181 } // namespace cast |
183 } // namespace media | 182 } // namespace media |
184 | 183 |
185 #endif // MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ | 184 #endif // MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ |
OLD | NEW |