Closed Bug 946110 Opened 11 years ago Closed 8 years ago

[B2G][WFD] Porting libstagefright_wfd to B2G

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: ethan, Assigned: hchang)

Details

Attachments

(3 files, 1 obsolete file)

Bring frameworks/av/media/libstagefright/wifi-display/** in Gecko with some adaption.

Test method:
Run frameworks/av/media/libstagefright/wifi-display/wfd.cpp, providing the filename of a pre-recorded media file.

1. Connection Setup
   Verify RTSP session establishment.

2. RTP Streaming
   Use any local media file as media source or use frame buffer with the support of OMX encoder.
Blocks: 925615
Assignee: nobody → ettseng
Attached WIP. Compilable and linkable but not tested yet. 

It can also be found here:

https://bitbucket.org/changhenry/mozilla-central/commits/branch/dev%2Fstagefright_porting
Use 

$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/system/b2g wfd

to execute test file
Attached patch libstagefright_wfd (WIP) v2 (obsolete) — Splinter Review
Changes:
1. Fixed HAVE_ANDROID_OS inconsistence issue.
2. Fixed broken android::StringPrintf caused by non-matched malloc/free.
3. Turned off gcc optimization for the debugging purpose.
4. Changed test binary name to TestWifiDisplay

Run TestWifiDisplay -l 0.0.0.0:7236 -f path/to/test_media
Hi Henry, it would be nice if you can post original Android source code or diff file here. It's easier for people to see the difference. :-)
Summary: [B2G][WFD] Porting libstagefright_wfd to Necko → [B2G][WFD] Porting libstagefright_wfd to B2G
Currently the library stagefright we ported from Android is located under Necko directory (network/protocol). The code location looks a little odd since libstagefright actually is not part of Necko.
The reason why we put it here is, this is just a temporary solution that we use libstagefright. We plan to rewrite/refactor the codes to create our own media playback engine and don't need to count on libstagefright.
Attached the original source files from aosp 4.3 frameworks/av/media/libstagefright/wifi-display.

Besides, you can also visit https://bitbucket.org/changhenry/mozilla-central/branches/compare/4414137..default to see the difference.

Furthermore, visit https://bitbucket.org/changhenry/mozilla-central/branches/compare/dev%2Fstagefright_porting..4414137 to see the change based off of the original stagefright files.
Attached ported stagefright along with wifip2p. It works with my gaia remote

https://github.com/elefant/gaia.git 

You can also find my developing mozilla-central branch here:

https://bitbucket.org/changhenry/mozilla-central/src/296ea778e847b63a1e6f1c02b502668f711e42b7/?at=dev%2Fstagefright_porting

To reproduce what I have done:

0) Get a nexus 4 and run B2G on it
1) Apply the attached patch onto your gecko or use the branch provided above.
2) Use my gaia remote (see above) and checkout to branch dev/wfd
3) $ ./build.sh gecko && ./flash gecko
4) Added "ro.moz.wifi.p2p_supported=1" to your system/build.prop (Don't forget to change the permission to 644 if it makes your phone unable to boot)
5) $ adb remount && adb push mozilla-central/objdir-gecko-central/dist/bin/wfdservice  system/bin
6) Reboot
7) $ adb shell LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/system/b2g wfdservice
8) Settings --> Wifi Direct --> Connect to dongle

If you see something like the following in logcat, you are miracast-ing!

I/RTPSender(  846): lost 86.72 % of packets during report interval.
I/WifiDisplaySource(  846): onMessageReceived 5
I/WifiDisplaySource(  846): onMessageReceived 5
I/WifiDisplaySource(  846): onMessageReceived 5
I/WifiDisplaySource(  846): onMessageReceived 5
I/WifiDisplaySource(  846): onMessageReceived 5

You should have got an mVirtualDisplayBuffer in GonkDisplayJB

---------------------------------------------------------------------

To remote display a local file:

(Branch off from step 5)

5) $ adb remount && adb push mozilla-central/objdir-gecko-central/dist/bin/TestWifiDisplay system/bin
6) $ adb shell LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/system/b2g TestWifiDisplay -l 0.0.0.0:7236 -f[file_path]
7) Settings --> Wifi Direct --> Connect to dongle

You should be watching the local file on the TV now!
Attachment #8356436 - Attachment is obsolete: true
By the way, you can find the modified ROM here https://github.com/kensuke/How-to-Miracast-on-AOSP to let some of nexus devices be the wifi display sink.
Assignee: ettseng → hchang
Great job, Henry!!
Apparently you are the owner of this bug now. :)
This is really a good starting point for the follow up development. Good job, Henry.
No longer blocks: 925615
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: