Index: media/cast/video_receiver/video_receiver.h |
diff --git a/media/cast/video_receiver/video_receiver.h b/media/cast/video_receiver/video_receiver.h |
index 697657e92e3ebb40700b8ba114d86080f6a16a2d..6ff0827773aebc6c868344b81e54bf3a46ab8304 100644 |
--- a/media/cast/video_receiver/video_receiver.h |
+++ b/media/cast/video_receiver/video_receiver.h |
@@ -41,10 +41,6 @@ class VideoDecoder; |
// 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 video data; or 2) |
// a frame of still-encoded video data, to be passed into an external video |
@@ -82,7 +78,7 @@ class VideoReceiver : public RtpReceiver, |
void IncomingPacket(scoped_ptr<Packet> packet); |
protected: |
- friend class VideoReceiverTest; // Invoked OnReceivedPayloadData(). |
+ friend class VideoReceiverTest; // Invokes OnReceivedPayloadData(). |
virtual void OnReceivedPayloadData(const uint8* payload_data, |
size_t payload_size, |
@@ -98,6 +94,10 @@ class VideoReceiver : 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(); |
@@ -109,10 +109,9 @@ class VideoReceiver : public RtpReceiver, |
scoped_ptr<transport::EncodedVideoFrame> 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 timing for the next cast message. |
void ScheduleNextCastMessage(); |
@@ -146,17 +145,39 @@ class VideoReceiver : public RtpReceiver, |
// Processes raw audio events to be sent over to the cast sender via RTCP. |
ReceiverRtcpEventSubscriber event_subscriber_; |
+ // Configured audio codec. |
const transport::VideoCodec codec_; |
- const base::TimeDelta target_delay_delta_; |
+ |
+ // The total amount of time between a frame's capture/recording on the sender |
+ // and its playback on the receiver (i.e., shown to a user). This is fixed as |
+ // a value large enough to give the system sufficient time to encode, |
+ // transmit/retransmit, receive, decode, and render; given its run-time |
+ // environment (sender/receiver hardware performance, network conditions, |
+ // etc.). |
+ const base::TimeDelta target_playout_delay_; |
+ |
+ // Hack: This is used in logic that: 1) determines whether to skip frames; and |
+ // 2) guesses playout times before lip-sync info is available. |
const base::TimeDelta expected_frame_duration_; |
+ |
+ // Set to false initially, then set to true after scheduling the periodic |
+ // sending of reports back to the sender. Reports are first scheduled just |
+ // after receiving a first packet (since the first packet identifies the |
+ // sender for the remainder of the session). |
+ bool reports_are_scheduled_; |
+ |
+ // Assembles packets into frames, providing this receiver with complete, |
+ // decodable EncodedFrames. |
Framer framer_; |
+ |
+ // Decodes frames into media::VideoFrame images for playback. |
scoped_ptr<VideoDecoder> video_decoder_; |
+ |
+ // Manages sending/receiving of RTCP packets, including sender/receiver |
+ // reports. |
Rtcp rtcp_; |
- base::TimeDelta time_offset_; // Sender-receiver offset estimation. |
- int time_offset_counter_; |
- bool time_incoming_packet_updated_; |
- base::TimeTicks time_incoming_packet_; |
- uint32 incoming_rtp_timestamp_; |
+ |
+ // Decrypts encrypted frames. |
transport::TransportEncryptionHandler decryptor_; |
// Outstanding callbacks to run to deliver on client requests for frames. |
@@ -164,7 +185,7 @@ class VideoReceiver : 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 FRAME_ACK_SENT as a frame event. In addition |
// it allows the event to be transmitted via RTCP. |