Giter Site home page Giter Site logo

rangho / webrtc-delay-estimation Goto Github PK

View Code? Open in Web Editor NEW
15.0 4.0 10.0 230 KB

Delay estimation logic extracted from WebRTC

License: BSD 3-Clause "New" or "Revised" License

CMake 1.45% C++ 95.93% C 2.03% Python 0.60%
webrtc delay-estimation signal-processing

webrtc-delay-estimation's Introduction

Profile banner image

Hit icon PGP key ID Last Updated on 05/24/24 04:11 AM, Korea Standard Time.

My name is RangHo Lee (and no, that's not my real name), an undergraduate student majoring in Computer Science and Engineering and English Literature and Linguistics at Sogang University! I love learning and trying new things, and of course, building stuff.

Do feel free to reach me out via:

Instagram Badge Email Badge Reddit Badge KakaoTalk Badge Line Badge Telegram Badge Twitter Badge LinkedIn Badge Discord Badge Twitch Badge

๐Ÿ™‹ More about me! I...

  • ๐ŸŒ ...speak Korean and English semi-competently and currently learning German, Japanese and Russian.
  • ๐Ÿ“ ...sometimes write articles on rangho.postype.com (in Korean, though).
    • It's not a tech blog; it's more like a trashcan where I stash my gibberish.
  • ๐ŸŽ™๏ธ ...like speaking in public about things I am interested in, such as:
    • this stuff about Linux customization (Korean),
    • this stuff about prototype-based object-oriented programming (also Korean),
    • this stuff about WebAssembly in general (English),
    • and this stuff about mixing Rust and Python (also English).
  • โœจ Fun Fact: ...used to learn Latin in high school and still in love with the language!

๐Ÿงฐ Languages and tools!

Here are the languages I have experience with!

Languages

C Language Badge C++ Badge Haskell Badge Rust Badge

C# Badge Java Badge Kotlin Badge Dart Badge Elixir Badge

Shell Script Badge Python Badge Lua Badge Ruby Badge

Svelte Badge HTML Badge CSS Badge JavaScript Badge TypeScript Badge

Editors

NeoVim Badge Vim Badge VSCode Badge Emacs Badge

Operating systems

Void Linux Badge Arch Linux Badge Kali Linux Badge Alpine Linux Badge Ubuntu Badge

Windows Badge macOS Badge

๐Ÿ“Š Some statistics!

Metrics

webrtc-delay-estimation's People

Contributors

rangho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

webrtc-delay-estimation's Issues

WebRTC delay estimator not working on the real time data.

I have successfully calculated the dalay using the wave files but when I try to calculate the delay with real time data then it doesnt give me any delay estimate but only a NoEstimateAvailableError();
Can you tell why this happens?

Unable to compile on Windows

Attempting to compile this project using Visual Studio on Windows fails with syntax errors in logging.cc. Tried both VS2019 CMake project configuration and CMake-generated vcxproj projects.

Since there are large amount of error messages from WinSock2.h, it is probably caused by the order of Windows header files.

Deleting #include <windows.h> from logging.cc was able to reduce the amount of error messages significantly.

Delay estimation result looks wrong

Although the main.cc source code follows the logic of WebRTC's delay estimation unit test, the number of estimated delay still looks very off. Below is the source which main.cc is based on.

// Verifies that the delay estimator produces correct delay for artificially
// delayed signals.
TEST(EchoPathDelayEstimator, DelayEstimation) {
  constexpr size_t kNumRenderChannels = 1;
  constexpr size_t kNumCaptureChannels = 1;
  constexpr int kSampleRateHz = 48000;
  constexpr size_t kNumBands = NumBandsForRate(kSampleRateHz);

  Random random_generator(42U);
  std::vector<std::vector<std::vector<float>>> render(
      kNumBands, std::vector<std::vector<float>>(
                     kNumRenderChannels, std::vector<float>(kBlockSize)));
  std::vector<std::vector<float>> capture(kNumCaptureChannels,
                                          std::vector<float>(kBlockSize));
  ApmDataDumper data_dumper(0);
  constexpr size_t kDownSamplingFactors[] = {2, 4, 8};
  for (auto down_sampling_factor : kDownSamplingFactors) {
    EchoCanceller3Config config;
    config.delay.down_sampling_factor = down_sampling_factor;
    config.delay.num_filters = 10;
    for (size_t delay_samples : {30, 64, 150, 200, 800, 4000}) {
      SCOPED_TRACE(ProduceDebugText(delay_samples, down_sampling_factor));
      std::unique_ptr<RenderDelayBuffer> render_delay_buffer(
          RenderDelayBuffer::Create(config, kSampleRateHz, kNumRenderChannels));
      DelayBuffer<float> signal_delay_buffer(delay_samples);
      EchoPathDelayEstimator estimator(&data_dumper, config,
                                       kNumCaptureChannels);

      absl::optional<DelayEstimate> estimated_delay_samples;
      for (size_t k = 0; k < (500 + (delay_samples) / kBlockSize); ++k) {
        RandomizeSampleVector(&random_generator, render[0][0]);
        signal_delay_buffer.Delay(render[0][0], capture[0]);
        render_delay_buffer->Insert(render);

        if (k == 0) {
          render_delay_buffer->Reset();
        }

        render_delay_buffer->PrepareCaptureProcessing();

        auto estimate = estimator.EstimateDelay(
            render_delay_buffer->GetDownsampledRenderBuffer(), capture);

        if (estimate) {
          estimated_delay_samples = estimate;
        }
      }

      if (estimated_delay_samples) {
        // Allow estimated delay to be off by one sample in the down-sampled
        // domain.
        size_t delay_ds = delay_samples / down_sampling_factor;
        size_t estimated_delay_ds =
            estimated_delay_samples->delay / down_sampling_factor;
        EXPECT_NEAR(delay_ds, estimated_delay_ds, 1);
      } else {
        ADD_FAILURE();
      }
    }
  }
}

Maybe reproducing this unit test helps to pinpoint the issue? Not sure if this unit test even passes in the WebRTC repository in the first place.

Attempt to run the program on Linux crashes with SIGILL

Backtrace looks like this:

#0  webrtc::AlignmentMixer::AlignmentMixer (this=0x5555556cd550, num_channels=1, downmix=false, adaptive_selection=true, activity_power_threshold=10000, prefer_first_two_channels=true)
    at /home/rangho/Documents/Development/RangHo/webrtc-delay-estimation/src/alignment_mixer.cc:54
#1  0x000055555557a3e5 in webrtc::AlignmentMixer::AlignmentMixer (this=0x5555556cd550, num_channels=1, config=...) at /home/rangho/Documents/Development/RangHo/webrtc-delay-estimation/src/alignment_mixer.cc:46
#2  0x000055555559119a in webrtc::(anonymous namespace)::RenderDelayBufferImpl::RenderDelayBufferImpl (this=0x5555556cd220, config=..., sample_rate_hz=16000, num_render_channels=1)
    at /home/rangho/Documents/Development/RangHo/webrtc-delay-estimation/src/render_delay_buffer.cc:160
#3  0x0000555555595841 in webrtc::RenderDelayBuffer::Create (config=..., sample_rate_hz=16000, num_render_channels=1) at /home/rangho/Documents/Development/RangHo/webrtc-delay-estimation/src/render_delay_buffer.cc:520
#4  0x0000555555563452 in main (argc=3, argv=0x7fffffffdfb8) at /home/rangho/Documents/Development/RangHo/webrtc-delay-estimation/src/main.cc:94

Unable to understand platform-dependent assembly instruction seems to be the issue here. Maybe SSE2?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.