#37 Crashes on 3.1 when starting control point

open-fixed
nobody
9
2014-07-09
2011-12-06
Anonymous
No

The stack seems to work on 2.3.x, but crashes when opening datagram sockets on 3.1 (not sure about 3.0):

12-06 12:11:50.400: I/System.out(14235): CyberGarage warning : Invalid argument
12-06 12:11:50.400: I/System.out(14235): java.net.BindException: Invalid argument
12-06 12:11:50.410: I/System.out(14235): at org.apache.harmony.luni.platform.OSNetworkSystem.bind(Native Method)
12-06 12:11:50.410: I/System.out(14235): at dalvik.system.BlockGuard$WrappedNetworkSystem.bind(BlockGuard.java:275)
12-06 12:11:50.410: I/System.out(14235): at org.apache.harmony.luni.net.PlainDatagramSocketImpl.bind(PlainDatagramSocketImpl.java:77)
12-06 12:11:50.410: I/System.out(14235): at java.net.DatagramSocket.bind(DatagramSocket.java:614)
12-06 12:11:50.410: I/System.out(14235): at java.net.DatagramSocket.<init>(DatagramSocket.java:563)
12-06 12:11:50.410: I/System.out(14235): at org.cybergarage.upnp.ssdp.HTTPUSocket.open(HTTPUSocket.java:124)
12-06 12:11:50.410: I/System.out(14235): at org.cybergarage.upnp.ssdp.HTTPUSocket.<init>(HTTPUSocket.java:58)
12-06 12:11:50.410: I/System.out(14235): at org.cybergarage.upnp.ssdp.SSDPSearchResponseSocket.<init>(SSDPSearchResponseSocket.java:40)
12-06 12:11:50.410: I/System.out(14235): at org.cybergarage.upnp.ssdp.SSDPSearchResponseSocketList.open(SSDPSearchResponseSocketList.java:93)
12-06 12:11:50.410: I/System.out(14235): at org.cybergarage.upnp.ControlPoint.start(ControlPoint.java:921)
12-06 12:11:50.410: I/System.out(14235): at org.cybergarage.upnp.ControlPoint.start(ControlPoint.java:965)
12-06 12:11:50.410: I/System.out(14235): at com.audiopartnership.streammagic.activities.DeviceConnectivityManagerActivity$1.onReceive(DeviceConnectivityManagerActivity.java:220)
12-06 12:11:50.410: I/System.out(14235): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:716)
12-06 12:11:50.410: I/System.out(14235): at android.os.Handler.handleCallback(Handler.java:587)
12-06 12:11:50.410: I/System.out(14235): at android.os.Handler.dispatchMessage(Handler.java:92)
12-06 12:11:50.410: I/System.out(14235): at android.os.Looper.loop(Looper.java:132)
12-06 12:11:50.410: I/System.out(14235): at android.app.ActivityThread.main(ActivityThread.java:4028)
12-06 12:11:50.410: I/System.out(14235): at java.lang.reflect.Method.invokeNative(Native Method)
12-06 12:11:50.410: I/System.out(14235): at java.lang.reflect.Method.invoke(Method.java:491)
12-06 12:11:50.410: I/System.out(14235): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
12-06 12:11:50.410: I/System.out(14235): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
12-06 12:11:50.410: I/System.out(14235): at dalvik.system.NativeStart.main(Native Method)

Discussion


  • Anonymous
    2011-12-06

    • priority: 5 --> 9
     

  • Anonymous
    2011-12-06

    I have fixed the issue. In HTTPUSocket.java, comment out the following in public boolean open(String bindAddr, int bindPort)

    try {
    // Changed to bind the specified address and port for Android v1.6 (2009/10/07)
    InetSocketAddress bindInetAddr = new InetSocketAddress(InetAddress.getByName(bindAddr), bindPort);
    ssdpUniSock = new DatagramSocket(bindInetAddr);
    }
    catch (Exception e) {
    Debug.warning(e);
    return false;
    }

    and uncomment the code below, removing the "return true"

    try {
    // Bind only using the port without the interface address. (2003/12/12)
    InetSocketAddress bindInetAddr = new InetSocketAddress(bindPort);
    ssdpUniSock = new DatagramSocket(null);
    ssdpUniSock.setReuseAddress(true);
    ssdpUniSock.bind(bindInetAddr);
    }
    catch (Exception e) {
    Debug.warning(e);
    return false;
    }

     

  • Anonymous
    2011-12-06

    • status: open --> open-fixed
     
  • Anand Singh
    Anand Singh
    2014-07-09

    Hi All I am using cyberlink-core-2.1.0 jar wiht Android Kitkat(4.4.2) play is not working.
    I have one more issue fetching render is also very slow.

    private static final String AVTransport1 = "urn:schemas-upnp-org:service:AVTransport:1";
    private static final String SetAVTransportURI = "SetAVTransportURI";
    private static final String RenderingControl = "urn:schemas-upnp-org:service:RenderingControl:1";
    private static final String Play = "Play";
    private static final String TAG = "MultiPointController";

    @Override
    public boolean play(Device device, String path) {
        Service service = device.getService(AVTransport1);
    
        if (service == null) {
            System.out.println("3");
            return false;
        }
    
        final Action action = service.getAction(SetAVTransportURI);
        if (action == null) {
            System.out.println("2");
             return false;
        }
    
        final Action playAction = service.getAction(Play);
    
        action.setArgumentValue("CurrentURI", path);
        action.setArgumentValue("CurrentURIMetaData", 0);
        if (TextUtils.isEmpty(path)) {
            return false;
        }
        if (!action.postControlAction()) {
            System.out.println("4");
            return false;
        }
    
        playAction.setArgumentValue("InstanceID", 0);
    
        playAction.setArgumentValue("Speed", "1");
        return playAction.postControlAction();
    }