mobile CCTV,mobile surveillance,police body worn cameras

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

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

[copyURL]

7

主题

26

帖子

89

积分

member

Rank: 2

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

使用道具 report

7

主题

26

帖子

89

积分

member

Rank: 2

积分
89
sofa
 Owner| poston 2019-12-5 15:33 | authorOnly
现在我推到后台的视频颜色不对?NV12ToNV21这个方法怎么用
reply agree Against

使用道具 report

7

主题

26

帖子

89

积分

member

Rank: 2

积分
89
bench
 Owner| poston 2019-12-5 15:39 | authorOnly
CameraUtils.findColorFormat() == 0怎么转else又怎么转
reply agree Against

使用道具 report

2

主题

414

帖子

1188

积分

vipMem

Rank: 6Rank: 6

积分
1188
ground
poston 2019-12-5 16:01 | authorOnly
alexanderjia post on2019-12-5 15:39
CameraUtils.findColorFormat() == 0怎么转else又怎么转

                    byte[] nv21 = new byte[data.length];
                    NV12ToNV21(nv21,data,width,height);
reply agree Against

使用道具 report

7

主题

26

帖子

89

积分

member

Rank: 2

积分
89
5#
 Owner| poston 2019-12-5 17:09 | authorOnly
请问下,就是我手机连头盔时头盔时关闭的,然后点了连接后再把头盔打开会有重连机制吗?
reply agree Against

使用道具 report

2

主题

414

帖子

1188

积分

vipMem

Rank: 6Rank: 6

积分
1188
6#
poston 2019-12-5 17:12 | authorOnly
alexanderjia post on2019-12-5 17:09
请问下,就是我手机连头盔时头盔时关闭的,然后点了连接后再把头盔打开会有重连机制吗?

没有,这个上层可以做判断来实现重连
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

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

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
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

creditRule

QQ|wireless surveillance

GMT+8, 2024-4-20 15:42 , Processed in 0.064456 second(s), 19 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

QuickReply backToTop BackToList