| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // outstanding requests (perhaps to just one or two). | 49 // outstanding requests (perhaps to just one or two). |
| 50 // | 50 // |
| 51 // This class is not thread safe. Should only be called from the Main cast | 51 // This class is not thread safe. Should only be called from the Main cast |
| 52 // thread. | 52 // thread. |
| 53 class AudioReceiver : public RtpReceiver, | 53 class AudioReceiver : public RtpReceiver, |
| 54 public RtpPayloadFeedback, | 54 public RtpPayloadFeedback, |
| 55 public base::NonThreadSafe, | 55 public base::NonThreadSafe, |
| 56 public base::SupportsWeakPtr<AudioReceiver> { | 56 public base::SupportsWeakPtr<AudioReceiver> { |
| 57 public: | 57 public: |
| 58 AudioReceiver(scoped_refptr<CastEnvironment> cast_environment, | 58 AudioReceiver(scoped_refptr<CastEnvironment> cast_environment, |
| 59 const AudioReceiverConfig& audio_config, | 59 const FrameReceiverConfig& audio_config, |
| 60 transport::PacedPacketSender* const packet_sender); | 60 transport::PacedPacketSender* const packet_sender); |
| 61 | 61 |
| 62 virtual ~AudioReceiver(); | 62 virtual ~AudioReceiver(); |
| 63 | 63 |
| 64 // Request a decoded audio frame. The audio signal data returned in the | 64 // Request a decoded audio frame. The audio signal data returned in the |
| 65 // callback will have the sampling rate and number of channels as requested in | 65 // callback will have the sampling rate and number of channels as requested in |
| 66 // the configuration that was passed to the ctor. | 66 // the configuration that was passed to the ctor. |
| 67 // | 67 // |
| 68 // The given |callback| is guaranteed to be run at some point in the future, | 68 // The given |callback| is guaranteed to be run at some point in the future, |
| 69 // even if to respond with NULL at shutdown time. | 69 // even if to respond with NULL at shutdown time. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 const int frequency_; | 150 const int frequency_; |
| 151 | 151 |
| 152 // The total amount of time between a frame's capture/recording on the sender | 152 // The total amount of time between a frame's capture/recording on the sender |
| 153 // and its playback on the receiver (i.e., shown to a user). This is fixed as | 153 // and its playback on the receiver (i.e., shown to a user). This is fixed as |
| 154 // a value large enough to give the system sufficient time to encode, | 154 // a value large enough to give the system sufficient time to encode, |
| 155 // transmit/retransmit, receive, decode, and render; given its run-time | 155 // transmit/retransmit, receive, decode, and render; given its run-time |
| 156 // environment (sender/receiver hardware performance, network conditions, | 156 // environment (sender/receiver hardware performance, network conditions, |
| 157 // etc.). | 157 // etc.). |
| 158 const base::TimeDelta target_playout_delay_; | 158 const base::TimeDelta target_playout_delay_; |
| 159 | 159 |
| 160 // Hack: This is used in logic that determines whether to skip frames. |
| 161 const base::TimeDelta expected_frame_duration_; |
| 162 |
| 160 // Set to false initially, then set to true after scheduling the periodic | 163 // Set to false initially, then set to true after scheduling the periodic |
| 161 // sending of reports back to the sender. Reports are first scheduled just | 164 // sending of reports back to the sender. Reports are first scheduled just |
| 162 // after receiving a first packet (since the first packet identifies the | 165 // after receiving a first packet (since the first packet identifies the |
| 163 // sender for the remainder of the session). | 166 // sender for the remainder of the session). |
| 164 bool reports_are_scheduled_; | 167 bool reports_are_scheduled_; |
| 165 | 168 |
| 166 // Assembles packets into frames, providing this receiver with complete, | 169 // Assembles packets into frames, providing this receiver with complete, |
| 167 // decodable EncodedFrames. | 170 // decodable EncodedFrames. |
| 168 Framer framer_; | 171 Framer framer_; |
| 169 | 172 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 198 // NOTE: Weak pointers must be invalidated before all other member variables. | 201 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 199 base::WeakPtrFactory<AudioReceiver> weak_factory_; | 202 base::WeakPtrFactory<AudioReceiver> weak_factory_; |
| 200 | 203 |
| 201 DISALLOW_COPY_AND_ASSIGN(AudioReceiver); | 204 DISALLOW_COPY_AND_ASSIGN(AudioReceiver); |
| 202 }; | 205 }; |
| 203 | 206 |
| 204 } // namespace cast | 207 } // namespace cast |
| 205 } // namespace media | 208 } // namespace media |
| 206 | 209 |
| 207 #endif // MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ | 210 #endif // MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ |
| OLD | NEW |