| 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 // Handles NACK list and manages ACK. | 5 // Handles NACK list and manages ACK. |
| 6 | 6 |
| 7 #ifndef MEDIA_CAST_FRAMER_CAST_MESSAGE_BUILDER_H_ | 7 #ifndef MEDIA_CAST_FRAMER_CAST_MESSAGE_BUILDER_H_ |
| 8 #define MEDIA_CAST_FRAMER_CAST_MESSAGE_BUILDER_H_ | 8 #define MEDIA_CAST_FRAMER_CAST_MESSAGE_BUILDER_H_ |
| 9 | 9 |
| 10 #include <deque> |
| 10 #include <map> | 11 #include <map> |
| 11 | 12 |
| 12 #include "media/cast/framer/frame_id_map.h" | 13 #include "media/cast/framer/frame_id_map.h" |
| 13 #include "media/cast/rtcp/rtcp.h" | 14 #include "media/cast/rtcp/rtcp.h" |
| 14 #include "media/cast/rtp_receiver/rtp_receiver_defines.h" | 15 #include "media/cast/rtp_receiver/rtp_receiver_defines.h" |
| 15 | 16 |
| 16 namespace media { | 17 namespace media { |
| 17 namespace cast { | 18 namespace cast { |
| 18 | 19 |
| 19 class RtpPayloadFeedback; | 20 class RtpPayloadFeedback; |
| 20 | 21 |
| 21 typedef std::map<uint32, base::TimeTicks> TimeLastNackMap; | 22 typedef std::map<uint32, base::TimeTicks> TimeLastNackMap; |
| 22 | 23 |
| 23 class CastMessageBuilder { | 24 class CastMessageBuilder { |
| 24 public: | 25 public: |
| 25 CastMessageBuilder(base::TickClock* clock, | 26 CastMessageBuilder(base::TickClock* clock, |
| 26 RtpPayloadFeedback* incoming_payload_feedback, | 27 RtpPayloadFeedback* incoming_payload_feedback, |
| 27 FrameIdMap* frame_id_map, | 28 FrameIdMap* frame_id_map, |
| 28 uint32 media_ssrc, | 29 uint32 media_ssrc, |
| 29 bool decoder_faster_than_max_frame_rate, | 30 bool decoder_faster_than_max_frame_rate, |
| 30 int max_unacked_frames); | 31 int max_unacked_frames); |
| 31 ~CastMessageBuilder(); | 32 ~CastMessageBuilder(); |
| 32 | 33 |
| 33 void CompleteFrameReceived(uint32 frame_id, bool is_key_frame); | 34 void CompleteFrameReceived(uint32 frame_id); |
| 34 bool TimeToSendNextCastMessage(base::TimeTicks* time_to_send); | 35 bool TimeToSendNextCastMessage(base::TimeTicks* time_to_send); |
| 35 void UpdateCastMessage(); | 36 void UpdateCastMessage(); |
| 36 void Reset(); | 37 void Reset(); |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 bool UpdateAckMessage(); | 40 bool UpdateAckMessage(uint32 frame_id); |
| 40 void BuildPacketList(); | 41 void BuildPacketList(); |
| 41 bool UpdateCastMessageInternal(RtcpCastMessage* message); | 42 bool UpdateCastMessageInternal(RtcpCastMessage* message); |
| 42 | 43 |
| 43 base::TickClock* const clock_; // Not owned by this class. | 44 base::TickClock* const clock_; // Not owned by this class. |
| 44 RtpPayloadFeedback* const cast_feedback_; | 45 RtpPayloadFeedback* const cast_feedback_; |
| 45 | 46 |
| 46 // CastMessageBuilder has only const access to the frame id mapper. | 47 // CastMessageBuilder has only const access to the frame id mapper. |
| 47 const FrameIdMap* const frame_id_map_; | 48 const FrameIdMap* const frame_id_map_; |
| 48 const uint32 media_ssrc_; | 49 const uint32 media_ssrc_; |
| 49 const bool decoder_faster_than_max_frame_rate_; | 50 const bool decoder_faster_than_max_frame_rate_; |
| 50 const int max_unacked_frames_; | 51 const int max_unacked_frames_; |
| 51 | 52 |
| 52 RtcpCastMessage cast_msg_; | 53 RtcpCastMessage cast_msg_; |
| 53 base::TimeTicks last_update_time_; | 54 base::TimeTicks last_update_time_; |
| 54 bool waiting_for_key_frame_; | |
| 55 | 55 |
| 56 TimeLastNackMap time_last_nacked_map_; | 56 TimeLastNackMap time_last_nacked_map_; |
| 57 | 57 |
| 58 bool slowing_down_ack_; | 58 bool slowing_down_ack_; |
| 59 bool acked_last_frame_; | 59 bool acked_last_frame_; |
| 60 uint32 last_acked_frame_id_; | 60 uint32 last_acked_frame_id_; |
| 61 std::deque<uint32> ack_queue_; |
| 61 | 62 |
| 62 DISALLOW_COPY_AND_ASSIGN(CastMessageBuilder); | 63 DISALLOW_COPY_AND_ASSIGN(CastMessageBuilder); |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 } // namespace cast | 66 } // namespace cast |
| 66 } // namespace media | 67 } // namespace media |
| 67 | 68 |
| 68 #endif // MEDIA_CAST_FRAMER_CAST_MESSAGE_BUILDER_H_ | 69 #endif // MEDIA_CAST_FRAMER_CAST_MESSAGE_BUILDER_H_ |
| OLD | NEW |