Fixed problems in neteq when RTP and decoder timestamps increment with
different sample rate frequency.

BUG=webrtc:7327

Problems before the fix:
1. NetEqImpl::timestamp_ is inconsistent. Initially it is set to
the original RTP timestamp, but later gets updated with the
scaled timestamp.
2. NetEqImpl::InsertPacketInternal::main_timestamp is set with
the original RTP timestamp, but later gets compared with the
NetEqImpl::timestamp_ which may or may not be with the same
sample rate frequency and this results in major problems.
3. IncreaseEndTimestamp(main_timestamp - timestamp_) will be
incorrect when SSRC is changed and not the first packet.
4. delay_manager_->Update() may not be always invoked, since
the (main_timestamp - timestamp_) >= 0 will not be true when
the previous scaled timestamp_ is bigger than the main_timestamp
(current RTP timestamp) even if the current RTP timestamp is
bigger than the previous RTP timestamp.
5. delay_manager_->Update() parameters are main_timestamp
which increments with the RTP sample rate frequency and the
fs_hz_ which is the decoder sample rate frequency. When these
two frequencies are different as is the case with g.722, the
DelayManager::Update() will misfire and calculate incorrect
packet_len_ms and inter-arrival time (IAT) as a result. This
in effect will cause neteq to enter kPreemptiveExpand operation
and will keep expanding the jitter buffer even if the RTP packets
arrive with no jitter at all.

The fix corrects all these problems by making sure the
main_timestamp and the timestamp_ are always set with the scaled
timestamp and increment with the decoder sample rate frequency.

Review-Url: https://codereview.webrtc.org/2743063005
Cr-Commit-Position: refs/heads/master@{#17232}
2 files changed
tree: 71c031f524c80050bdb7e969cb59a69d0ce85a4c
  1. build_overrides/
  2. data/
  3. infra/
  4. resources/
  5. tools-webrtc/
  6. webrtc/
  7. .clang-format
  8. .git-blame-ignore-revs
  9. .gitignore
  10. .gn
  11. AUTHORS
  12. BUILD.gn
  13. check_root_dir.py
  14. cleanup_links.py
  15. codereview.settings
  16. DEPS
  17. LICENSE
  18. license_template.txt
  19. LICENSE_THIRD_PARTY
  20. OWNERS
  21. PATENTS
  22. PRESUBMIT.py
  23. pylintrc
  24. README.md
  25. WATCHLISTS
README.md

WebRTC is a free, open software project that provides browsers and mobile applications with Real-Time Communications (RTC) capabilities via simple APIs. The WebRTC components have been optimized to best serve this purpose.

Our mission: To enable rich, high-quality RTC applications to be developed for the browser, mobile platforms, and IoT devices, and allow them all to communicate via a common set of protocols.

The WebRTC initiative is a project supported by Google, Mozilla and Opera, amongst others. This page is maintained by the Google Chrome team.

Development

See http://www.webrtc.org/native-code/development for instructions on how to get started developing with the native code.

More info