| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <list> | 11 #include <list> |
| 12 #include <map> | 12 #include <map> |
| 13 #include <memory> | 13 #include <memory> |
| 14 #include <sstream> | 14 #include <sstream> |
| 15 #include <string> | 15 #include <string> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| 20 #include "webrtc/base/checks.h" | 20 #include "webrtc/base/checks.h" |
| 21 #include "webrtc/base/event.h" | 21 #include "webrtc/base/event.h" |
| 22 #include "webrtc/base/timeutils.h" | |
| 23 #include "webrtc/call.h" | 22 #include "webrtc/call.h" |
| 24 #include "webrtc/call/transport_adapter.h" | 23 #include "webrtc/call/transport_adapter.h" |
| 25 #include "webrtc/common_video/include/frame_callback.h" | 24 #include "webrtc/common_video/include/frame_callback.h" |
| 26 #include "webrtc/modules/include/module_common_types.h" | 25 #include "webrtc/modules/include/module_common_types.h" |
| 27 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 26 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
| 28 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 27 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
| 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
| 30 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" | 29 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
| 31 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 30 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
| 32 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" | 31 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
| (...skipping 2893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2926 } | 2925 } |
| 2927 } | 2926 } |
| 2928 | 2927 |
| 2929 static const int32_t kMaxTimestampGap = kDefaultTimeoutMs * 90; | 2928 static const int32_t kMaxTimestampGap = kDefaultTimeoutMs * 90; |
| 2930 auto timestamp_it = last_observed_timestamp_.find(ssrc); | 2929 auto timestamp_it = last_observed_timestamp_.find(ssrc); |
| 2931 if (timestamp_it == last_observed_timestamp_.end()) { | 2930 if (timestamp_it == last_observed_timestamp_.end()) { |
| 2932 last_observed_timestamp_[ssrc] = timestamp; | 2931 last_observed_timestamp_[ssrc] = timestamp; |
| 2933 } else { | 2932 } else { |
| 2934 // Verify timestamps are reasonably close. | 2933 // Verify timestamps are reasonably close. |
| 2935 uint32_t latest_observed = timestamp_it->second; | 2934 uint32_t latest_observed = timestamp_it->second; |
| 2936 int32_t timestamp_gap = rtc::TimeDiff(timestamp, latest_observed); | 2935 // Wraparound handling is unnecessary here as long as an int variable |
| 2936 // is used to store the result. |
| 2937 int32_t timestamp_gap = timestamp - latest_observed; |
| 2937 EXPECT_LE(std::abs(timestamp_gap), kMaxTimestampGap) | 2938 EXPECT_LE(std::abs(timestamp_gap), kMaxTimestampGap) |
| 2938 << "Gap in timestamps (" << latest_observed << " -> " | 2939 << "Gap in timestamps (" << latest_observed << " -> " |
| 2939 << timestamp << ") too large for SSRC: " << ssrc << "."; | 2940 << timestamp << ") too large for SSRC: " << ssrc << "."; |
| 2940 timestamp_it->second = timestamp; | 2941 timestamp_it->second = timestamp; |
| 2941 } | 2942 } |
| 2942 | 2943 |
| 2943 rtc::CritScope lock(&crit_); | 2944 rtc::CritScope lock(&crit_); |
| 2944 // Wait for media packets on all ssrcs. | 2945 // Wait for media packets on all ssrcs. |
| 2945 if (!ssrc_observed_[ssrc] && !only_padding) { | 2946 if (!ssrc_observed_[ssrc] && !only_padding) { |
| 2946 ssrc_observed_[ssrc] = true; | 2947 ssrc_observed_[ssrc] = true; |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3501 private: | 3502 private: |
| 3502 bool video_observed_; | 3503 bool video_observed_; |
| 3503 bool audio_observed_; | 3504 bool audio_observed_; |
| 3504 SequenceNumberUnwrapper unwrapper_; | 3505 SequenceNumberUnwrapper unwrapper_; |
| 3505 std::set<int64_t> received_packet_ids_; | 3506 std::set<int64_t> received_packet_ids_; |
| 3506 } test; | 3507 } test; |
| 3507 | 3508 |
| 3508 RunBaseTest(&test); | 3509 RunBaseTest(&test); |
| 3509 } | 3510 } |
| 3510 } // namespace webrtc | 3511 } // namespace webrtc |
| OLD | NEW |