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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 for (it = frame_map_.begin(); it != frame_map_.end(); ++it) { | 131 for (it = frame_map_.begin(); it != frame_map_.end(); ++it) { |
132 if (it->second->Complete() && ContinuousFrame(it->second.get())) { | 132 if (it->second->Complete() && ContinuousFrame(it->second.get())) { |
133 *frame_id = it->first; | 133 *frame_id = it->first; |
134 return true; | 134 return true; |
135 } | 135 } |
136 } | 136 } |
137 return false; | 137 return false; |
138 } | 138 } |
139 | 139 |
| 140 bool FrameIdMap::HaveMultipleDecodableFrames() const { |
| 141 // Find the oldest decodable frame. |
| 142 FrameMap::const_iterator it; |
| 143 bool found_one = false; |
| 144 for (it = frame_map_.begin(); it != frame_map_.end(); ++it) { |
| 145 if (it->second->Complete() && DecodableVideoFrame(it->second.get())) { |
| 146 if (found_one) { |
| 147 return true; |
| 148 } else { |
| 149 found_one = true; |
| 150 } |
| 151 } |
| 152 } |
| 153 return false; |
| 154 } |
| 155 |
140 uint32 FrameIdMap::LastContinuousFrame() const { | 156 uint32 FrameIdMap::LastContinuousFrame() const { |
141 uint32 last_continuous_frame_id = last_released_frame_; | 157 uint32 last_continuous_frame_id = last_released_frame_; |
142 uint32 next_expected_frame = last_released_frame_; | 158 uint32 next_expected_frame = last_released_frame_; |
143 | 159 |
144 FrameMap::const_iterator it; | 160 FrameMap::const_iterator it; |
145 | 161 |
146 do { | 162 do { |
147 next_expected_frame++; | 163 next_expected_frame++; |
148 it = frame_map_.find(next_expected_frame); | 164 it = frame_map_.find(next_expected_frame); |
149 if (it == frame_map_.end()) | 165 if (it == frame_map_.end()) |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // Current frame is not necessarily referencing the last frame. | 262 // Current frame is not necessarily referencing the last frame. |
247 // Do we have the reference frame? | 263 // Do we have the reference frame? |
248 if (IsOlderFrameId(frame->referenced_frame_id(), last_released_frame_)) { | 264 if (IsOlderFrameId(frame->referenced_frame_id(), last_released_frame_)) { |
249 return true; | 265 return true; |
250 } | 266 } |
251 return frame->referenced_frame_id() == last_released_frame_; | 267 return frame->referenced_frame_id() == last_released_frame_; |
252 } | 268 } |
253 | 269 |
254 } // namespace cast | 270 } // namespace cast |
255 } // namespace media | 271 } // namespace media |
OLD | NEW |