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

Source side implementation #304

Closed
wants to merge 220 commits into from
Closed

Conversation

edurenye
Copy link

@edurenye edurenye commented Nov 7, 2018

Rebased the pull #172 , just trying to speed up issue #4

derekdai and others added 30 commits November 7, 2018 00:13
If miraclecat is GO, miracle-dhcp runs as server, it send out SERVER_ID
option in little endian, causes non-GO peer connect to wrong IP address, so
RTSP connection can't be established.

In scenario like, say Android (GO) <-> miracalcast (non-GO), the DHCP service
is provided by Android, in this case, the SERVER_ID is in expected byte order
(big endian).
since gstplayer has argument --audio to enable audio support but no
way to disable it, audio=False might a better choise.

If we left audio=True and incoming stream has video only, the whole
pipeline will be blocked and wait for audio stream.
The new option --lazy-managed will let miracle-wifid don't managed the
links automatically. Instead, the link will be managed only when the new
DBus property Managed was set to true. So this will be possible that
miracle-wifid could be conexists with other network tools like
networkmanager.

For example, unmange the device in networkmanager with setting the DBus
property org.freedesktop.NetworkManager.Device.Managed to false and
manage it in miracle-wifid with setting
org.freedesktop.miracle.wifi.Link.Managed to true, then both them could
works and don't need to kill each other.

Besides, there is new command named make-managed in miracle-wifictl and
miracle-sinkctla.
while parsing ctl_peer and ctl_link objects, if a ctl_peer appear prior
to its related ctl_link, -EINVAL is reported, and miracle-*ctl will quit
immediately.
derekdai and others added 16 commits November 7, 2018 00:59
Change-Id: Ib8fc055789a1bd0a6df3075b176385407c17a74c
Change-Id: I7460f6173815f054c0dc51accf96a531f6faf4b1
Change-Id: Iafefe39652d9ade06c58e41f091a30df274cb091
Change-Id: Iacf53af83c151c6746f778a97201ed3f7bd55504
Change-Id: I8434fe9dfcf141156635d7a6f8a9c2aaa4469263
Change-Id: Ibfc14aca1c03b8cd6b50a49d5128da8597acb898
Change-Id: I1b7f18a704203fc60a35b67f09936095ae6398f0
Change-Id: Id2f5a8d6bbfbbd205dbe25e8b8bc0ddd289591e5
Change-Id: Ia51167abc10c4c8bc03f58883aca06e05879c6e9
Change-Id: Ic5752cea7b64307c3c2d8dd0a8389d3b18ab3339
Change-Id: Ifa2b1ee85b2abf4cc0d9d7f40c452517cb94761d
Change-Id: I12e647f9b4f13aaa0aedf81907aa251675d2be32
when a session is destroyed due to peer free event, dispd_out_session must
detach from sink to it won't cause double free.

Change-Id: I71ad7e977fa71ec84f12f5e914786aa24a650f34
…method

Change-Id: I1e3994517f492aa7d9996494110077c81acc41b4
Change-Id: I4d72782516ffff487010cd94cc47ec68133ff257
@albfan
Copy link
Owner

albfan commented Nov 8, 2018

Will review today, thanks for working on this.

Btw, there's an initiative under GNOME based on miracast.

https://github.com/benzea/gnome-screencast

Take a look and join us if you want to see this feature on your laptop

@Arzte
Copy link

Arzte commented Nov 26, 2018

@albfan Did you ever get a chance to review this PR?

(sorry if I'm being a bother here, just been a few days)

@albfan
Copy link
Owner

albfan commented Nov 27, 2018

Sorry, didn't get to review it yet. Hope to do soon

@albfan
Copy link
Owner

albfan commented Dec 25, 2018

@edurenye finally reviewing this. I set up a Docker container to build miraclecast 3a459e5. Build is passing on master. Nice!

I have:

but this PR do not compile for me. does it for you? You can check build output here: https://semaphoreci.com/albfan/miraclecast-2/branches/wip-edurenye-source-side/builds/5

cmake output
-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29") 
-- Checking for module 'glib-2.0'
--   Found glib-2.0, version 2.58.1
-- Checking for module 'libudev'
--   Found libudev, version 239
-- Checking for module 'libsystemd'
--   Found libsystemd, version 239
-- Checking for module 'gstreamer-1.0'
--   Found gstreamer-1.0, version 1.14.4
-- Checking for module 'gstreamer-base-1.0'
--   Found gstreamer-base-1.0, version 1.14.4
-- Checking for module 'systemd>=213'
--   Found systemd, version 239
-- Found Readline: /usr/include  
-- Compiling with Readline support
-- Compiling with Readline support
-- Found Vala: /usr/bin/valac  
-- Checking for module 'gio-2.0'
--   Found gio-2.0, version 2.58.1
-- Checking for module 'gdk-3.0'
--   Found gdk-3.0, version 3.24.2
-- Checking for module 'gstreamer-1.0'
--   Found gstreamer-1.0, version 1.14.4
-- Checking for module 'check'
--   No package 'check' found
-- Configuring done
-- Generating done
-- Build files have been written to: /source/build-cmake
Scanning dependencies of target miracle-shared
[  1%] Building C object src/shared/CMakeFiles/miracle-shared.dir/rtsp.c.o
[  3%] Building C object src/shared/CMakeFiles/miracle-shared.dir/shl_htable.c.o
[  5%] Building C object src/shared/CMakeFiles/miracle-shared.dir/shl_log.c.o
[  7%] Building C object src/shared/CMakeFiles/miracle-shared.dir/shl_ring.c.o
[  9%] Building C object src/shared/CMakeFiles/miracle-shared.dir/shl_util.c.o
[ 11%] Building C object src/shared/CMakeFiles/miracle-shared.dir/wpas.c.o
[ 12%] Linking C static library libmiracle-shared.a
[ 12%] Built target miracle-shared
Scanning dependencies of target miracled
[ 14%] Building C object src/CMakeFiles/miracled.dir/miracled.c.o
[ 16%] Linking C executable miracled
[ 16%] Built target miracled
Scanning dependencies of target miracle-wifid
[ 18%] Building C object src/wifi/CMakeFiles/miracle-wifid.dir/wifid.c.o
[ 20%] Building C object src/wifi/CMakeFiles/miracle-wifid.dir/wifid-dbus.c.o
[ 22%] Building C object src/wifi/CMakeFiles/miracle-wifid.dir/wifid-link.c.o
/source/src/wifi/wifid-link.c: In function 'link_set_config_methods':
/source/src/wifi/wifid-link.c:393:1: error: expected declaration or statement at end of input
 }
 ^
At top level:
/source/src/wifi/wifid-link.c:387:6: warning: 'link_supplicant_p2p_scan_changed' defined but not used [-Wunused-function]
 void link_supplicant_p2p_scan_changed(struct link *l, bool new_value)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/source/src/wifi/wifid-link.c:374:6: warning: 'link_supplicant_stopped' defined but not used [-Wunused-function]
 void link_supplicant_stopped(struct link *l)
      ^~~~~~~~~~~~~~~~~~~~~~~
/source/src/wifi/wifid-link.c:359:6: warning: 'link_supplicant_started' defined but not used [-Wunused-function]
 void link_supplicant_started(struct link *l)
      ^~~~~~~~~~~~~~~~~~~~~~~
/source/src/wifi/wifid-link.c:351:13: warning: 'link_get_mac_addr' defined but not used [-Wunused-function]
 const char *link_get_mac_addr(struct link *l)
             ^~~~~~~~~~~~~~~~~
/source/src/wifi/wifid-link.c:337:6: warning: 'link_get_p2p_scanning' defined but not used [-Wunused-function]
 bool link_get_p2p_scanning(struct link *l)
      ^~~~~~~~~~~~~~~~~~~~~
/source/src/wifi/wifid-link.c:321:5: warning: 'link_set_p2p_scanning' defined but not used [-Wunused-function]
 int link_set_p2p_scanning(struct link *l, bool set)
     ^~~~~~~~~~~~~~~~~~~~~
/source/src/wifi/wifid-link.c:313:13: warning: 'link_get_wfd_subelements' defined but not used [-Wunused-function]
 const char *link_get_wfd_subelements(struct link *l)
             ^~~~~~~~~~~~~~~~~~~~~~~~
/source/src/wifi/wifid-link.c:283:5: warning: 'link_set_wfd_subelements' defined but not used [-Wunused-function]
 int link_set_wfd_subelements(struct link *l, const char *val)
     ^~~~~~~~~~~~~~~~~~~~~~~~
/source/src/wifi/wifid-link.c:275:13: warning: 'link_get_friendly_name' defined but not used [-Wunused-function]
 const char *link_get_friendly_name(struct link *l)
             ^~~~~~~~~~~~~~~~~~~~~~
/source/src/wifi/wifid-link.c:221:5: warning: 'link_renamed' defined but not used [-Wunused-function]
 int link_renamed(struct link *l, const char *ifname)
     ^~~~~~~~~~~~
/source/src/wifi/wifid-link.c:208:6: warning: 'link_supplicant_p2p_state_known' defined but not used [-Wunused-function]
 void link_supplicant_p2p_state_known(struct link *l, int state)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/source/src/wifi/wifid-link.c:184:5: warning: 'link_manage' defined but not used [-Wunused-function]
 int link_manage(struct link *l, bool set)
     ^~~~~~~~~~~
/source/src/wifi/wifid-link.c:179:6: warning: 'link_get_managed' defined but not used [-Wunused-function]
 bool link_get_managed(struct link *l)
      ^~~~~~~~~~~~~~~~
/source/src/wifi/wifid-link.c:174:5: warning: 'link_get_p2p_state' defined but not used [-Wunused-function]
 int link_get_p2p_state(struct link *l)
     ^~~~~~~~~~~~~~~~~~
make[2]: *** [src/wifi/CMakeFiles/miracle-wifid.dir/build.make:89: src/wifi/CMakeFiles/miracle-wifid.dir/wifid-link.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:218: src/wifi/CMakeFiles/miracle-wifid.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Please rebase your PR and grab those CI changes. You can run docker locally with:

docker build -t miraclecast-image .

@albfan
Copy link
Owner

albfan commented Dec 25, 2018

btw: there's a https://github.com/albfan/miraclecast/tree/derekdai-master-squashed where I squashed all the back and forth in derekdai fork. Maybe rebase that branch would be a better option

@AtesComp
Copy link

The error is as listed:

/source/src/wifi/wifid-link.c: In function 'link_set_config_methods':
/source/src/wifi/wifid-link.c:393:1: error: expected declaration or statement at end of input
 }
 ^

In file "src/wifi/wifid-link.c" at line 173 there is no ending "}" for function "link_set_config_methods"
Adding fixes compile.

@AtesComp
Copy link

AtesComp commented Jan 1, 2019

I compiled with autotools and seemed to finish ok, but it didn't compile the dispctl tool.

I then used cmake and the compile failed because the src/disp CMakeList.txt file needs directives for GLIB2 includes and libs.

@albfan
Copy link
Owner

albfan commented Jan 1, 2019

@AtesComp that kind of fixes are on my squashed branch 56f9d44, that's why doesn't make much sense to me to keep this MR open. code do not even compile

@AtesComp
Copy link

AtesComp commented Jan 1, 2019

Its hard to tell which particular branch you continue to reference as it doesn't show up in the branch listing since its not named. It's also is difficult to tell which branch is the most up to date. So please make this repository make sense. Are you referring to the "docker" branch or "56f9d44b19"?

Please update the readme file for your prefered branch with updated instructions for the operational use of the software--the use of dispctl in the "documentation" section.

@AtesComp
Copy link

AtesComp commented Jan 1, 2019

I suppose you mean the "derekdai-master-squashed" branch which shows up as "stale". If this is the branch, please update the readme there.

@albfan
Copy link
Owner

albfan commented Jan 2, 2019

Update README?

@AtesComp
Copy link

AtesComp commented Jan 2, 2019

Yes, the README.md file. In this or the derickdai-master-squashed branch (I've switched). The "Documentation" section lists steps for sink and peer, but these branches used the miraclecast-dispd and miraclecast-wifid services to automate switching NetworkManager with dbus. Also, miracle-dispctl (and miracle-wifictl) need updated documentation there.

@albfan
Copy link
Owner

albfan commented Jan 2, 2019

There're lot of noise in @derekdai PR. I just squashed to avoid rebase things like enable audio, disable audio which happens in that fork, but in the end I need to patch it, so I just want to notice that. It is supposed implementation should keep reviews and rework there in #172, but it stops to get progress so I guess we are not in a step where we can update docs about how it should work.

The whole idea is to enable Wifi Direct (through a dbus setting that could be trigger in gnome-control-center at some point) so you save battery when not using miracast, and then enable miracast where a service like miracle-dispd manages everything.

I'm collapsing this days comments with long output with <details></details> so one could follow comments on PR, where all the info about it should be avaliable.

@AtesComp you can always suggest a PR on top of dereckdai-master-squashed and I will be happy to merge your suggestions.

As said, I will close this PR, it doesn't even compile so just confuse people looking for source implementation

@albfan albfan closed this Jan 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants