mobile CCTV,mobile surveillance,police body worn cameras

 forgetPW
 registerNow
search
12NextPage
backToList newPost
view: 2304|reply: 14
打印 prevThread nextThread

视频流已经成功推后台黑屏

[copyURL]

7

主题

26

帖子

89

积分

member

Rank: 2

积分
89
jumpTo
owner
poston 2019-12-5 14:53 | authorOnly 回帖奖励 |viewing |阅读模式
帽子上的视频流已经推到手机了,但是我把手机的推到后台就是黑的,应该是格式不对,是要用 NV12ToNV21这个方法不?怎么用
reply

使用道具 report

7

主题

26

帖子

89

积分

member

Rank: 2

积分
89
15#
 Owner| poston 2019-12-19 15:12 | authorOnly
解决了,现在的问题是帽子连不上热点。好蛋疼!
reply agree Against

使用道具 report

60

主题

1413

帖子

5805

积分

Moderator

Rank: 7Rank: 7Rank: 7

积分
5805
14#
poston 2019-12-19 14:48 | authorOnly
电话沟通解决了吧?
reply agree Against

使用道具 report

7

主题

26

帖子

89

积分

member

Rank: 2

积分
89
13#
 Owner| poston 2019-12-19 13:55 | authorOnly
爷,那个第二方法里的regexAIp,regexBIp,regexCIp这几个参数是什么?然后第一个方法最后获取的是个List,我用第几个?
reply agree Against

使用道具 report

60

主题

1413

帖子

5805

积分

Moderator

Rank: 7Rank: 7Rank: 7

积分
5805
12#
poston 2019-12-19 13:50 | authorOnly
嗯,您动手试试。
reply agree Against

使用道具 report

7

主题

26

帖子

89

积分

member

Rank: 2

积分
89
11#
 Owner| poston 2019-12-19 13:36 | authorOnly
是调下面那个方法就可以了吗?
reply agree Against

使用道具 report

2

主题

414

帖子

1188

积分

vipMem

Rank: 6Rank: 6

积分
1188
10#
poston 2019-12-11 15:16 | authorOnly
xuwei post on2019-12-11 15:15
private ArrayList getDeviceIPList() {
                        String localIp = Utils.getHostIP();
                        if (localIp !=  ...

        public static String getHostIP() {
                String hostIp;
                Pattern ip = Pattern.compile("(" + regexAIp + ")|" + "(" + regexBIp + ")|" + "(" + regexCIp + ")");
                Enumeration<NetworkInterface> networkInterfaces = null;
                try {
                        networkInterfaces = NetworkInterface.getNetworkInterfaces();
                } catch (SocketException e) {
                        e.printStackTrace();
                        Log.e(TAG, "getHostIP:" + e.toString());
                }
                InetAddress address;
                while (networkInterfaces.hasMoreElements()) {
                        NetworkInterface networkInterface = networkInterfaces.nextElement();
                        Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
                        while (inetAddresses.hasMoreElements()) {
                                address = inetAddresses.nextElement();
                                String hostAddress = address.getHostAddress();
                                Matcher matcher = ip.matcher(hostAddress);
                                if (matcher.matches()) {
                                        hostIp = hostAddress;
                                        Log.i(TAG, "getHostIP:" + hostIp);
                                        return hostIp;
                                }

                        }
                }
                Log.w(TAG, "getHostIP return null");
                return null;
        }
reply agree Against

使用道具 report

2

主题

414

帖子

1188

积分

vipMem

Rank: 6Rank: 6

积分
1188
9#
poston 2019-12-11 15:15 | authorOnly

        private ArrayList<String> getDeviceIPList() {
                        String localIp = Utils.getHostIP();
                        if (localIp != null) {
                                String s = "null";
                                DatagramPacket dp = new DatagramPacket(s.getBytes(), 0, s.length());
                                DatagramSocket socket = null;
                                String[] sp = localIp.split("\\.");
                                try {
                                        socket = new DatagramSocket();
                                        int position = 2;
                                        while (position < 255) {
                                                dp.setAddress(InetAddress.getByName(sp[0] + "." + sp[1] + "." + sp[2] + "." + String.valueOf(position)));
                                                socket.send(dp);
                                                position++;
                                                if (position == 125) {//分两段掉包,一次性发的话,达到236左右,会耗时3秒左右再往下发
                                                        socket.close();
                                                        socket = new DatagramSocket();
                                                }
                                        }
                                } catch (SocketException e) {
                                        e.printStackTrace();
                                } catch (UnknownHostException e) {
                                        e.printStackTrace();
                                } catch (IOException e) {
                                        e.printStackTrace();
                                } finally {
                                        if (socket != null) {
                                                socket.close();
                                        }
                                }
                        }

                        BufferedReader br = null;
                        ArrayList<String> result = null;
                        try {
                                result = new ArrayList<>();
                                br = new BufferedReader(new FileReader("/proc/net/arp"));//读取这个文件
                                String line;
                                while ((line = br.readLine()) != null) {
                                        String[] splitted = line.split(" +");//将文件里面的字段分割开来
                                        if (splitted.length >= 4 && splitted[3] != null && !splitted[3].equals("00:00:00:00:00:00")) {
                                                // Basic sanity check
                                                String mac = splitted[3];// 文件中分别是IP address  HW type Flags HW address mask Device
                                                //然后我们拿取HW address  也就是手机的mac地址进行匹配  如果有 就证明是手机
                                                if (mac.matches("..:..:..:..:..:..")) {
                                                        boolean isReachable = InetAddress.getByName(splitted[0]).isReachable(1000);
                                                        if (!isReachable) {// 若isReachable不成立
                                                                Socket socket = null;
                                                                try {
                                                                        socket = new Socket();
                                                                        SocketAddress socAddress = new InetSocketAddress(InetAddress.getByName(splitted[0]), 554);
                                                                        socket.connect(socAddress, 1500);
                                                                        Log.i(TAG, "socket.isConnected():" + socket.isConnected() + "---ip--->" + splitted[0]);
                                                                        if (socket.isConnected()) {
                                                                                isReachable = true;
                                                                        }
                                                                } catch (Exception e) {
                                                                        Log.e(TAG, "" + e.toString());
                                                                } finally {
                                                                        try {
                                                                                socket.close();
                                                                        } catch (IOException e) {
                                                                                e.printStackTrace();
                                                                        }
                                                                }
                                                        }
                                                        Log.i(TAG, "isReachable:" + isReachable + "--ip:" + splitted[0]);
                                                        if (isReachable) {
                                                                result.add(splitted[0]);//最后如果能匹配 那就证明是连接了热点的手机  加到这个集合里 里面有所有需要的信息
                                                        }
                                                }
                                        }
                                }
                        } catch (Exception e) {
                                Log.e(TAG, "ApTask.doInBackground.error " + e.getMessage());
                                e.printStackTrace();
                        } finally {
                                try {
                                        if (br != null) {
                                                br.close();
                                        }
                                } catch (IOException e) {
                                        Log.e(TAG, "ApTask.doInBackground.error " + e.getMessage());
                                        e.printStackTrace();
                                }
                        }
                        return result;
        }
reply agree Against

使用道具 report

2

主题

414

帖子

1188

积分

vipMem

Rank: 6Rank: 6

积分
1188
8#
poston 2019-12-5 17:27 | authorOnly
alexanderjia post on2019-12-5 17:14
case IRTSPCam.RTSP_EVENT_OPEN:
IRTSPCam.RTSP_RESULT_FAILED是等这个事件出发后实现重连吗

可以的,              
reply agree Against

使用道具 report

7

主题

26

帖子

89

积分

member

Rank: 2

积分
89
7#
 Owner| poston 2019-12-5 17:14 | authorOnly
case IRTSPCam.RTSP_EVENT_OPEN:
IRTSPCam.RTSP_RESULT_FAILED是等这个事件出发后实现重连吗
reply agree Against

使用道具 report

QQ|wireless surveillance

GMT+8, 2024-5-3 12:34 , Processed in 0.065426 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

QuickReply backToTop BackToList