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 #include "media/cast/framer/frame_id_map.h" | 5 #include "media/cast/framer/frame_id_map.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/cast/rtp_receiver/rtp_receiver_defines.h" | 8 #include "media/cast/rtp_receiver/rtp_receiver_defines.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 FrameIdMap::FrameIdMap() | 55 FrameIdMap::FrameIdMap() |
56 : waiting_for_key_(true), | 56 : waiting_for_key_(true), |
57 last_released_frame_(kStartFrameId), | 57 last_released_frame_(kStartFrameId), |
58 newest_frame_id_(kStartFrameId) {} | 58 newest_frame_id_(kStartFrameId) {} |
59 | 59 |
60 FrameIdMap::~FrameIdMap() {} | 60 FrameIdMap::~FrameIdMap() {} |
61 | 61 |
62 PacketType FrameIdMap::InsertPacket(const RtpCastHeader& rtp_header) { | 62 PacketType FrameIdMap::InsertPacket(const RtpCastHeader& rtp_header) { |
63 uint32 frame_id = rtp_header.frame_id; | 63 uint32 frame_id = rtp_header.frame_id; |
64 uint32 reference_frame_id; | 64 uint32 reference_frame_id; |
65 if (rtp_header.is_reference) { | 65 reference_frame_id = rtp_header.reference_frame_id; |
66 reference_frame_id = rtp_header.reference_frame_id; | |
67 } else { | |
68 reference_frame_id = static_cast<uint32>(frame_id - 1); | |
69 } | |
70 | 66 |
71 if (rtp_header.is_key_frame && waiting_for_key_) { | 67 if (rtp_header.is_key_frame && waiting_for_key_) { |
72 last_released_frame_ = static_cast<uint32>(frame_id - 1); | 68 last_released_frame_ = static_cast<uint32>(frame_id - 1); |
73 waiting_for_key_ = false; | 69 waiting_for_key_ = false; |
74 } | 70 } |
75 | 71 |
76 VLOG(3) << "InsertPacket frame:" << frame_id | 72 VLOG(3) << "InsertPacket frame:" << frame_id |
77 << " packet:" << static_cast<int>(rtp_header.packet_id) | 73 << " packet:" << static_cast<int>(rtp_header.packet_id) |
78 << " max packet:" << static_cast<int>(rtp_header.max_packet_id); | 74 << " max packet:" << static_cast<int>(rtp_header.max_packet_id); |
79 | 75 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 // Current frame is not necessarily referencing the last frame. | 246 // Current frame is not necessarily referencing the last frame. |
251 // Do we have the reference frame? | 247 // Do we have the reference frame? |
252 if (IsOlderFrameId(frame->referenced_frame_id(), last_released_frame_)) { | 248 if (IsOlderFrameId(frame->referenced_frame_id(), last_released_frame_)) { |
253 return true; | 249 return true; |
254 } | 250 } |
255 return frame->referenced_frame_id() == last_released_frame_; | 251 return frame->referenced_frame_id() == last_released_frame_; |
256 } | 252 } |
257 | 253 |
258 } // namespace cast | 254 } // namespace cast |
259 } // namespace media | 255 } // namespace media |
OLD | NEW |