Skip to content
RC3 edited this page Jan 22, 2014 · 2 revisions

.

wfd cmd, black screen on Android >= 4.3

  mDisplayBinder = mComposerClient->createDisplay(String8("foo"), false /* secure */);
  SurfaceComposerClient::openGlobalTransaction();
  mComposerClient->setDisplaySurface(mDisplayBinder, mSurfaceTexture);
  Rect layerStackRect(1280, 720);  // XXX fix this.
  Rect displayRect(1280, 720);
  mComposerClient->setDisplayProjection(
          mDisplayBinder, 0 /* 0 degree rotation */,
          layerStackRect,
          displayRect);
  // ...
  SurfaceComposerClient::closeGlobalTransaction();

fixed? (maybe...)

  mDisplayBinder = mComposerClient->createDisplay(String8("foo"), false /* secure */);
  SurfaceComposerClient::openGlobalTransaction();
  mComposerClient->setDisplaySurface(mDisplayBinder, mSurfaceTexture);
  Rect layerStackRect(1280, 720);  // XXX fix this.

  Rect displayRect(1280, 720);
  mComposerClient->setDisplayProjection(
          mDisplayBinder, 0 /* 0 degree rotation */,
          layerStackRect,
          displayRect);
  SurfaceComposerClient::setDisplayLayerStack(mDisplayBinder, 0); // add
  SurfaceComposerClient::closeGlobalTransaction();

Currently, I face 4.4 framework sequence, so I didn't tried wfd cmd on 4.3 and 4.4. In my trying, Miracast Source execute without called setDisplayLayerStack is black screen on Sink. Add calling setDisplayLayerStack, screen appeared.

this fix applied wfd cmd on 4.3... what happen?
report to me! or XDA thread!!

update: tried myself on Android 4.3.1_r1 / wfd cmd

  • N4 to GN without setDisplayLayerStack() -> black screen on Sink (GN)
  • N4 to GN with setDisplayLayerStack() -> illegal size but Source to Sink screen appeared.
  • GN / N7 to N4 with setDisplayLayerStack() -> connection succeeded, but nothing happen on Sink.

GN(Source) log to N4

I/WifiDisplaySource(1204): Received PLAY request.
I/RTPSender(1204): lost 86.72 % of packets during report interval.
I/RTPSender(1204): lost 86.72 % of packets during report interval.
I/RTPSender(1204): lost 86.72 % of packets during report interval.
I/RTPSender(1204): lost 86.72 % of packets during report interval.

GN to N4(Sink) log

I/NetworkSession(4719): connecting socket 18 to 10.10.1.101:10000
I/WifiDisplaySink(4719): We're now connected.
I/RTPReceiver(4719): connectUDPSession RTP successful.
I/RTPReceiver(4719): connectUDPSession RTCP successful.
I/WifiDisplaySink(4719): MediaReceiver initialization completed w/ err 0
E/NetworkSession(4719): readMore on socket 18 failed w/ error -104 (Connection reset by peer)
E/WifiDisplaySink(4719): An error occurred in session 1 (-104, 'Recv failed./Connection reset by peer').
I/WifiDisplaySink(4719): Lost control connection.

N4 to GN(Sink) log - success pattern

I/NetworkSession(1511): connecting socket 14 to 10.10.1.100:10000
I/WifiDisplaySink(1511): We're now connected.
I/RTPReceiver(1511): connectUDPSession RTP successful.
I/RTPReceiver(1511): connectUDPSession RTCP successful.
I/WifiDisplaySink(1511): MediaReceiver initialization completed w/ err 0
I/avc_utils(1511): found AVC codec config (1280 x 720, Baseline-profile level 3.1)
I/OMXClient(1511): Using client-side OMX mux.
W/SocketClient(121): write error (Broken pipe)
E/NetworkSession(1511): readMore on socket 14 failed w/ error -104 (Connection reset by peer)
E/WifiDisplaySink(1511): An error occurred in session 1 (-104, 'Recv failed./Connection reset by peer').
I/WifiDisplaySink(1511): Lost control connection.

0) Warn!

THIS URL IS MY OWN LOCAL PC's OpenGrok. Replace your one!

1) P2P Connection

Starting at Setting App

562            mDisplayManager.connectWifiDisplay(display.getDeviceAddress());

* http://localhost:8080/source/xref/android-4.4.2_r1/frameworks/base/services/java/com/android/server/display/DisplayManagerService.java#541 ``` 540 @Override // Binder call 541 public void connectWifiDisplay(String address) { 542 if (address == null) { 543 throw new IllegalArgumentException("address must not be null"); 544 } 545 mContext.enforceCallingOrSelfPermission(Manifest.permission.CONFIGURE_WIFI_DISPLAY, 546 "Permission required to connect to a wifi display"); 547 548 final long token = Binder.clearCallingIdentity(); 549 try { 550 synchronized (mSyncRoot) { 551 if (mWifiDisplayAdapter != null) { 552 mWifiDisplayAdapter.requestConnectLocked(address); 553 } 554 } 555 } finally { 556 Binder.restoreCallingIdentity(token); 557 } 558 } ```

...
VERY LONG source code analysis is here... uploaded later...

only summary
...


2) after connected

945    private void advertiseDisplay(final WifiDisplay display,

3) createDisplay

502    public static IBinder createDisplay(String name, boolean secure) {

4) sendDisplayDeviceEventLocked

103    protected final void sendDisplayDeviceEventLocked(

5) configureDisplayInTransactionLocked

1044    private void configureDisplayInTransactionLocked(DisplayDevice device) {

// ... setDisplayLayerStack
// ... setDisplayProjection

6) performTraversalInTransactionLocked

718        public void performTraversalInTransactionLocked() {

// ... setDisplaySurface

so, required these methods.

openGlobalTransaction, setDisplaySurface, setDisplayProjection, setDisplayLayerStack, closeGlobalTransaction


update

  • 2014/01/18 - first
  • 2014/01/22 - 2nd - 4.3 tried...