Chromium Code Reviews| Index: media/cast/audio_receiver/audio_receiver.h |
| diff --git a/media/cast/audio_receiver/audio_receiver.h b/media/cast/audio_receiver/audio_receiver.h |
| index 5cc8f88f4cd44029d9b60d0da040bd48cdbb4f14..dd0decb44d99af099df5e9b372dac1ab0bd2f262 100644 |
| --- a/media/cast/audio_receiver/audio_receiver.h |
| +++ b/media/cast/audio_receiver/audio_receiver.h |
| @@ -39,10 +39,6 @@ class AudioDecoder; |
| // each step of the pipeline (i.e., encode frame, then transmit/retransmit from |
| // the sender, then receive and re-order packets on the receiver, then decode |
| // frame) can vary in duration and is typically very hard to predict. |
| -// Heuristics will determine when the targeted playout delay is insufficient in |
| -// the current environment; and the receiver can then increase the playout |
| -// delay, notifying the sender, to account for the extra variance. |
| -// TODO(miu): Make the last sentence true. http://crbug.com/360111 |
| // |
| // Two types of frames can be requested: 1) A frame of decoded audio data; or 2) |
| // a frame of still-encoded audio data, to be passed into an external audio |
| @@ -81,10 +77,6 @@ class AudioReceiver : public RtpReceiver, |
| // Deliver another packet, possibly a duplicate, and possibly out-of-order. |
| void IncomingPacket(scoped_ptr<Packet> packet); |
| - // Update target audio delay used to compute the playout time. Rtcp |
| - // will also be updated (will be included in all outgoing reports). |
| - void SetTargetDelay(base::TimeDelta target_delay); |
| - |
| protected: |
| friend class AudioReceiverTest; // Invokes OnReceivedPayloadData(). |
| @@ -102,6 +94,10 @@ class AudioReceiver : public RtpReceiver, |
| // the future to wait for missing/incomplete frames. |
| void EmitAvailableEncodedFrames(); |
| + // Helper used by EmitAvailableEncodedFrames() to schedule itself to be called |
| + // again after |wait_time| has elapsed. |
| + void RetryEmitAfterWaiting(base::TimeDelta wait_time); |
| + |
| // Clears the |is_waiting_for_consecutive_frame_| flag and invokes |
| // EmitAvailableEncodedFrames(). |
| void EmitAvailableEncodedFramesAfterWaiting(); |
| @@ -113,10 +109,9 @@ class AudioReceiver : public RtpReceiver, |
| scoped_ptr<transport::EncodedAudioFrame> encoded_frame, |
| const base::TimeTicks& playout_time); |
| - // Return the playout time based on the current time and rtp timestamp. |
| - base::TimeTicks GetPlayoutTime(base::TimeTicks now, uint32 rtp_timestamp); |
| - |
| - void InitializeTimers(); |
| + // Computes the playout time for a frame with the given |rtp_timestamp|. If |
| + // lip-sync info is not available, a best-guess is returned (a hack). |
| + base::TimeTicks GetPlayoutTime(uint32 rtp_timestamp) const; |
| // Schedule the next RTCP report. |
| void ScheduleNextRtcpReport(); |
| @@ -152,13 +147,11 @@ class AudioReceiver : public RtpReceiver, |
| const transport::AudioCodec codec_; |
| const int frequency_; |
| - base::TimeDelta target_delay_delta_; |
| + base::TimeDelta target_playout_delay_; |
| + bool reports_are_scheduled_; |
|
hubbe
2014/05/14 23:12:23
Maybe add comments for these variables?
miu
2014/05/16 22:45:47
Done.
|
| Framer framer_; |
| scoped_ptr<AudioDecoder> audio_decoder_; |
| Rtcp rtcp_; |
| - base::TimeDelta time_offset_; |
| - base::TimeTicks time_first_incoming_packet_; |
| - uint32 first_incoming_rtp_timestamp_; |
| transport::TransportEncryptionHandler decryptor_; |
| // Outstanding callbacks to run to deliver on client requests for frames. |
| @@ -166,7 +159,7 @@ class AudioReceiver : public RtpReceiver, |
| // True while there's an outstanding task to re-invoke |
| // EmitAvailableEncodedFrames(). |
| - bool is_waiting_for_consecutive_frame_; |
| + bool is_waiting_to_emit_frames_; |
| // This mapping allows us to log AUDIO_ACK_SENT as a frame event. In addition |
| // it allows the event to be transmitted via RTCP. |