Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROUTE support using GPAC #18

Open
wants to merge 7 commits into
base: development
Choose a base branch
from

Conversation

rbouqueau
Copy link

@rbouqueau rbouqueau commented Nov 30, 2021

Work in progress. See #16. I put it here to get early feedback if any.

TODO:

  • Isolate libflute use.
  • Add ROUTE class.
  • Provide demo material
  • Rename variables containing the name 'flute' / cleanup.

@kuehnhammer
Copy link
Contributor

Hi - just noticed your pull request, great to see that you already started with the integration!

I've just commited the code for seamless switching (see #19).
It includes the new abstraction for basic and seamless use cases, as well as the new cache management.

The location for the libflute calls has moved into ContentStream. I quite like your idea of using a lib-agnostic interface to handle file reception, I guess we could and should adapt the new classes accordingly as well.

@rbouqueau
Copy link
Author

Hi Klaus, thanks for the feedback. I've just pushed a MVP.

To test the implementation:

  1. Build GPAC as stated in the README.
  2. Modify the code to create a ReceiverRoute instead of a ReceiverFlute, and adjust the listening address accordingly (e.g. 225.1.1.0:6000). Cf patch below.
  3. Launch a fake ROUTE server: gpac -threads=-1 -i avgen:sr=48000:ch=2 @ ffenc:c=aac @1 ffenc:c=avc:fintra=2 @ @1 dasher:profile=live:dmode=dynamic @ -o route://225.1.1.0:6000/live.mpd (not low latency)

I have the following local patch:

diff --git a/src/Middleware.cpp b/src/Middleware.cpp
index 28bde09..6570cfb 100644
--- a/src/Middleware.cpp
+++ b/src/Middleware.cpp
@@ -45,7 +45,9 @@ void MBMS_RT::Middleware::tick_handler()
       if (!dest.empty() && is_service_announcement && _services.find(tmgi) == _services.end()) {
         // automatically start receiving the service announcement
         // 26.346 5.2.3.1.1 : the pre-defined TSI value shall be "0". 
+        dest = "225.1.1.0:6000"; //Harcoded
         _services[tmgi] = std::make_unique<MBMS_RT::Service>(_cfg, tmgi, dest, 0 /*TSI*/, _interface, _io_service);
       }
     }
diff --git a/src/Service.cpp b/src/Service.cpp
index 477363b..799e90b 100644
--- a/src/Service.cpp
+++ b/src/Service.cpp
@@ -18,6 +18,7 @@
 #include <regex>
 #include "Service.h"
 #include "ServiceFlute.h"
+#include "ServiceRoute.h"
 
 #include <boost/bind.hpp>
 #include "spdlog/spdlog.h"
@@ -40,7 +41,8 @@ MBMS_RT::Service::Service(const libconfig::Config& cfg, std::string tmgi, const
   _mcast_port = mcast.substr(delim + 1);
   spdlog::info("Starting FLUTE receiver on {}:{} for TSI {}", _mcast_addr, _mcast_port, _tsi); 
   _flute_thread = std::thread{[&](){
-    _flute_receiver = std::make_unique<ReceiverFlute>(_iface, _mcast_addr, atoi(_mcast_port.c_str()), _tsi, io_service);
+    _flute_receiver = std::make_unique<ReceiverRoute>(_iface, _mcast_addr, atoi(_mcast_port.c_str()), _tsi, io_service);
   }};
 }
 

Note that GPAC could have exposed the content directly using its HTTP embedded server. It allows to have low latency DASH(/HLS) ; otherwise if the HTTP server encounters the end of a served file it has no way to know if it is still being populated. But as per the discussion we had with the group I plugged on a lower level GPAC API.

@kuehnhammer
Copy link
Contributor

kuehnhammer commented Dec 9, 2021

As just discussed with Romain, I will test this and rebase it into the seamless-switching branch

@rbouqueau
Copy link
Author

I've just had a look at the GPAC files we need to add at link time for a minimal link (see here):

  • gpac/src/media_tools/route_dmx.o
  • gpac/src/utils/list.o
  • gpac/src/utils/alloc.o
  • gpac/src/utils/error.o
  • gpac/src/utils/os_divers.o
  • gpac/src/utils/os_file.o
  • gpac/src/utils/os_net.o
  • gpac/src/utils/configfile.o
  • gpac/src/utils/bitstream.o
  • gpac/src/utils/xml_parser.o
  • gpac/src/utils/os_thread.o
  • gpac/src/utils/Remotery.o
  • gpac/src/utils/gzio.o
  • -ldl -lz -lGL
  • gpac/src/utils/os_config_init.o
  • gpac/src/utils/base_encoding.o
  • gpac/src/utils/utf.o
  • gpac/src/utils/module.o
  • gpac/src/utils/url.o
  • gpac/src/utils/os_module.o

gpac/src/media_tools/route_dmx.o gpac/src/utils/list.o gpac/src/utils/alloc.o gpac/src/utils/error.o gpac/src/utils/os_divers.o gpac/src/utils/os_file.o gpac/src/utils/os_net.o gpac/src/utils/configfile.o gpac/src/utils/bitstream.o gpac/src/utils/xml_parser.o gpac/src/utils/os_thread.o gpac/src/utils/Remotery.o gpac/src/utils/gzio.o -ldl -lz gpac/src/utils/os_config_init.o gpac/src/utils/base_encoding.o gpac/src/utils/utf.o gpac/src/utils/module.o -lGL gpac/src/utils/url.o gpac/src/utils/os_module.o

@dsilhavy dsilhavy added this to the 0.11.0 milestone Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants