• 设备互联(三)多屏协同简析


         想对设备互联有深入了解,最简单直接的还是拿业内最好的精品进行分析。

         如下是Pad跟手机的p2p组网的日志,平板作为GO,手机是GC,频率是5G频段,因为5G信号频宽较宽,无线环境比较干净,干扰少,网速稳定,做短距离传输极好。为什么是平板作为GO而不是手机,另外也可以关注下手机投PC侧是否也是PC侧作为GO, 这里可以去了解下PC侧的p2p连接,会有答案。

    1. wpa_supplicant: p2p0: P2P: Use primary interface for group operations
    2. wpa_supplicant: p2p0: P2P: Starting GO
    3. wpa_supplicant: p2p0: P2P: Request scan (that will be skipped) to start GO)
    4. wpa_supplicant: p2p0: Setting scan request: 0.000000 sec
    5. wpa_supplicant: Start a pre-selected network without scan step
    6. wpa_supplicant: SAE-PK: Not a valid password (length)
    7. wpa_supplicant: Setting up AP (SSID='DIRECT-jo-HONOR Pad View7 Pro')
    8. wpa_supplicant: nl80211: Set mode ifindex 17 iftype 9 (P2P_GO)
    9. wpa_supplicant: nl80211: Interface p2p0 mode change to P2P - disable 11b rates
    10. wpa_supplicant: nl80211: Setup AP(p2p0) - device_ap_sme=1 use_monitor=0
    11. wpa_supplicant: nl80211: Set freq 5180 (ht_enabled=0, vht_enabled=0, he_enabled=0, bandwidth=0 MHz, cf1=0 MHz, cf2=0 MHz)
    12. wpa_supplicant: * freq=5180
    13. wpa_supplicant: * channel_type=0
    14. wpa_supplicant: Determining HT/VHT options based on driver capabilities (freq=5180 chan=36)
    15. wpa_supplicant: Enable HT support (p2p_group=1 11a=1 ht40_hw_capab=1 ssid->ht40=0)
    16. wpa_supplicant: P2P: * Device Info
    17. wpa_supplicant: P2P: * Device ID: 1a:**:**:**:9b:a2
    18. wpa_supplicant: P2P: GO - group idle
    19. wpa_supplicant: P2P: * Device Info
    20. wpa_supplicant: P2P: * Device ID: 1a:**:**:**:9b:a2
    21. wpa_supplicant: BSS count 1, BSSID mask 00:**:**:**:00:00 (0 bits)
    22. wpa_supplicant: nl80211: Added 802.11b mode based on 802.11g information
    23. wpa_supplicant: nl80211: Mode IEEE 802.11g: 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472 2484[DISABLED]
    24. wpa_supplicant: nl80211: Mode IEEE 802.11a: 5180 5200 5220 5240 5260[RADAR] 5280[RADAR] 5300[RADAR] 5320[RADAR] 5500[DISABLED][RADAR] 5520[DISABLED][RADAR] 5540[DISABLED][RADAR] 5560[DISABLED][RADAR] 5580[DISABLED][RADAR]
    25. wpa_supplicant: nl80211: Mode IEEE 802.11b: 2412 2417 2422 2427 2432 2437 2442 2447 2452 2457 2462 2467 2472 2484[DISABLED]
    26. wpa_supplicant: Completing interface initialization
    27. wpa_supplicant: Mode: IEEE 802.11a Channel: 36 Frequency: 5180 MHz
    28. wpa_supplicant: hostapd_handle_dfs_offload: iface->cac_started: 0
    29. wpa_supplicant: hostapd_handle_dfs_offload: freq 5180 MHz does not require DFS. Continue channel/AP setup
    30. wpa_supplicant: Proceed with AP/channel setup
    31. wpa_supplicant: 40/80 MHz channel width is not supported in 5/6 GHz
    32. wpa_supplicant: nl80211: Set freq 5180 (ht_enabled=1, vht_enabled=0, he_enabled=1, bandwidth=20 MHz, cf1=5180 MHz, cf2=0 MHz)
    33. wpa_supplicant: * freq=5180
    34. wpa_supplicant: * bandwidth=20
    1. wpa_supplicant: p2p-p2p0-3: P2P: WLAN AP allows cross connection
    2. wpa_supplicant: p2p-p2p0-3: State: SCANNING -> ASSOCIATING
    3. wpa_supplicant: WPS: AP vendor specific ies from wpa_bss
    4. wpa_supplicant: Notifying state change event to hidl control: 5
    5. wpa_supplicant: bss->freq (5805)
    6. wpa_supplicant: Limit connection to BSSID 1a:**:**:**:9b:a2 freq=5805 MHz based on scan results (bssid_set=1 wps=0)
    7. wpa_supplicant: p2p-p2p0-3: [PMF]ssid-ieee80211w=3,wpa_s-conf-pmf=0
    8. wpa_supplicant: nl80211: Set mode ifindex 56 iftype 8 (P2P_CLIENT)
    9. wpa_supplicant: nl80211: Connect (ifindex=56)
    10. wpa_supplicant: * bssid=1a:**:**:**:9b:a2
    11. wpa_supplicant: * freq=5805
    12. wpa_supplicant: * SSID=DI***************************
    13. wpa_supplicant: * pairwise=0xfac04
    14. wpa_supplicant: * group=0xfac04
    15. wpa_supplicant: * Auth Type 0
    16. wpa_supplicant: * WPS:0, privacy:1
    17. wpa_supplicant: nl80211: Connect request send successfully
    18. wpa_supplicant: Not configuring frame filtering - BSS 00:**:**:**:00:00 is not a Hotspot 2.0 network
    19. wpa_supplicant: P2P: * Device Info: addr 1a:**:**:**:9b:a2 primary device type 10-0050F204-5 device name 'HONOR Pad View7 Pro' config methods 0x188
    20. wpa_supplicant: nl80211: Drv Event 46 (NL80211_CMD_CONNECT) received for p2p-p2p0-3
    21. wpa_supplicant: nl80211: Set drv->ssid based on scan res info to 'DI***************************'
    22. wpa_supplicant: p2p-p2p0-3: freq=5805 MHz
    23. wpa_supplicant: p2p-p2p0-3: State: ASSOCIATING -> ASSOCIATED
    24. wpa_supplicant: Notifying state change event to hidl control: 6
    25. wpa_supplicant: p2p-p2p0-3: Associated to a new BSS: BSSID=1a:**:**:**:9b:a2

      p2p连接后就是开始能力集协商,从日志看其实这协商就是正常的rtsp能力交互,包括音视频编解码格式协商,uibc能力协商。手机端的多屏协同是一个服务,过滤进程号可以跟踪连接过程的日志,不过很有意思的是连接过程中先初始化DLNA,但是我试了图片拖曳、视频播放,都没有走DLNA,更像是DMC,但是看不出控制的是什么,以后多连些设备再看看了。 

    1. KitUtil : In getMetaDataAppId, Failed to read meta data for the AppID.
    2. PlayerService: onBind in
    3. PlayerManager: unregisterListener pid not found pid = 31954
    4. CallBackMgr: removeListenerAndUsingCapability pid =31954
    5. CallBackMgr: addListenerAndUsingCapability pid = 31954, listener = com.huawei.android.airsharing.service.b@af857b4
    6. NetworkMgr: init in.
    7. MiraCastEngine: before setWifiDisplayEnable().
    8. MiraCastEngine: netState is other
    9. MiraCastEngine: NetworkStateRecv mWifiFreq: 5805, mP2pFreq: -1
    10. MiraCastEngine: NetworkStateRecv mWifiFreq: 5805, mP2pFreq: -1
    11. MiraCastEngine: netState is other
    12. MiraCastEngine: NetworkStateRecv mWifiFreq: 5805, mP2pFreq: -1
    13. CallBackMgr: setIsUserAgreeDisclaimer true
    14. CallBackMgr: updateUsingCapability pid = 31954, capability = 13
    15. PlayerSourceManager: setUsingCapability pid = 31954, usingCapability = 13
    16. DlnaControllerManager: startDlna(String mode) with mode[DMC].
    17. DLNA_JNI: Enter Java_com_huawei_android_multiscreen_dlna_sdk_jni_DlnaUniswitch_dlnaApiSetDmcAutoBrowseDisable
    18. DLNA_JNI: Enter CheckPermissoin uid_t 1000
    19. DLNA_JNI: Leave Java_com_huawei_android_multiscreen_dlna_sdk_jni_DlnaUniswitch_dlnaApiSetDmcAutoBrowseDisable
    20. DLNA_JNI: Enter CheckPermissoin uid_t 1000
    21. DLNA_JNI: Enter Java_com_huawei_android_multiscreen_dlna_sdk_jni_DlnaUniswitch_dlnaApiStackInit
    22. DLNA_JNI: Enter FindCallback
    23. DLNA_JNI: Leave FindCallback
    24. DLNA_JNI: before DlnaApiRegisterSysCallback
    25. VPPUPNP : [VPPDLNA][DlnaApiStackInit][:508]-:DlnaApiStackInit Enter, initMode = 9, DLNA_STACK_VERSION = MediaOS V100R001C00B706 2.0 20140430
    26. DLNA_JNI: Enter DlnaGetIPAndMAC
    27. DLNA_JNI: Leave DlnaGetIPAndMAC
    28. HiSight-HiSightManager: [32a4d110d55eb87, 918d87, 2ffbf4a] the session of pid is null, the session of airSharing pid is null: true
    29. UtilTools: [32a4d110d55eb87, e70371, 2ffbf4a] getRealProjectionDevice, belong to trusted list.
    30. PlayerSourceManager: [32a4d110d55eb87, e70371, 2ffbf4a] AirSharing 11.1.0.325 connectDevice, callerPackage :com.huawei.dmsdp, currentTimeMillis :1667895509584
    31. PlayerSourceManager: [32a4d110d55eb87, e70371, 2ffbf4a] scheduleConnectDevice in
    32. PlayerSourceManager: [32a4d110d55eb87, 3eebb58, e70371] handle connect device
    33. PlayerSourceManager: [70e58710d58f3e7, 0, 0] connectDevice in, callingPid is 31954; mode is = MIRROR; mCallerPackage = com.huawei.dmsdp
    34. HiSight-HiSightManager: [70e58710d58f3e7, 0, 0] the session of pid is null, the session of airSharing pid is null: true
    35. WifiInfoEvent: [70e58710d58f3e7, 0, 0] get info is invalid
    36. UPNP-1.6.25: MAX-AGE = 1800
    37. UPNP-1.6.25: MX = 0
    38. UPNP-1.6.25: DeviceType = urn:schemas-upnp-org:device:MediaServer:1
    39. UPNP-1.6.25: ServiceType =

    然后开始是RTSP协商,协商多媒体参数,视频格式是H265,协商了上限、下限的码率,这个上限、下限应该是根据RTCP反馈网络进行动态调整视频码率,视频宽高,另外就是UIBC的行为定义。

    1. HiSight-RTSP-Encap: [70e58810d59716a, 26234c2, 0] Encapsulate common response RTSP/1.0 200 OK
    2. HiSight-RTSP-Encap: Date: 2022-11-08 16:18:29 PM Tue
    3. HiSight-RTSP-Encap: Server: localhost
    4. HiSight-RTSP-Encap: Cseq: 1
    5. HiSight-RTSP-Encap:
    6. HiSight-RTSP-Encap: [70e58810d59716a, 26234c2, 0] Send announce option request.
    7. HiSight-RTSP-Encap: [70e58810d59716a, 32156e4, 0] Send M1 option request OPTIONS * RTSP/1.0
    8. HiSight-RTSP-Encap: Date: 2022-11-08 16:18:29 PM Tue
    9. HiSight-RTSP-Encap: CSeq: 2
    10. HiSight-RTSP-Encap:
    11. HiSight-RTSP-Encap: [70e58810d59716a, 8eb963, 0] Encapsulate sink option response sequence id: 2
    12. HiSight-RTSP-Encap: [70e58810d59716a, 8eb963, 0] Sending defaultResponse: RTSP/1.0 200 OK
    13. HiSight-RTSP-Encap: Server: localhost
    14. HiSight-RTSP-Encap: Cseq: 2
    15. HiSight-RTSP-Encap: Public: hisight1.1, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER
    16. HiSight-RTSP-Encap:
    17. HiSight-RTSP-Encap: --------------
    18. HiSight-RTSP-Encap: [70e58810d59716a, 8eb963, 0] Send M3 GET_PARAMETER request GET_PARAMETER rtsp://localhost/hisight1.1 RTSP/1.0
    19. HiSight-RTSP-Encap: Date: 2022-11-08 16:18:29 PM Tue
    20. HiSight-RTSP-Encap: CSeq: 3
    21. HiSight-RTSP-Encap: Content-Type: text/parameters
    22. HiSight-RTSP-Encap: Content-Length: 186
    23. HiSight-RTSP-Encap:
    24. HiSight-RTSP-Encap: his_version
    25. HiSight-RTSP-Encap: his_video_formats
    26. HiSight-RTSP-Encap: his_audio_codecs
    27. HiSight-RTSP-Encap: his_uibc_capability
    28. HiSight-RTSP-Encap: his_feature
    29. HiSight-RTSP-Encap: his_vtp
    30. HiSight-RTSP-Encap: his_device_type
    31. HiSight-RTSP-Encap: his_network_config
    32. HiSight-RTSP-Encap: his_player_controller_capability
    33. HiSight-RTSP-Encap: his_media_capability
    34. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Send set parampter M4.
    35. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Set video format, width 1080, height 2400
    36. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Set audio format 1
    37. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encapsulate feature set 101
    38. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encapsulate feature set 103
    39. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Support Uibc true, support Vtp true
    40. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is left_point_down
    41. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is left_point_up
    42. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is left_move
    43. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is left_key_down
    44. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is left_key_up
    45. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is mouse_down
    46. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is mouse_up
    47. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is mouse_move
    48. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is vertical_wheel
    49. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is horizontal_wheel
    50. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is left_point_down
    51. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is left_point_up
    52. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is left_move
    53. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is left_key_down
    54. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is left_key_up
    55. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is mouse_down
    56. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is mouse_up
    57. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is mouse_move
    58. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is vertical_wheel
    59. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Encap generic str is horizontal_wheel
    60. HiSight-RTSP-Encap: [70e58810d59716a, 2ad31c7, 0] Send M4 request projection mode MIRROR
    61. HiSight-RTSP-Encap: [70e58810d59716a, 3316272, 0] Encapsulate action method in.
    62. HiSight-RTSP-Encap: [70e58810d59716a, 3316272, 0] Sending M5 SET_PARAMETER rtsp://localhost/hisight1.1 RTSP/1.0
    63. HiSight-RTSP-Encap: Date: 2022-11-08 16:18:29 PM Tue
    64. HiSight-RTSP-Encap: CSeq: 5
    65. HiSight-RTSP-Encap: Content-Type: text/parameters
    66. HiSight-RTSP-Encap: Content-Length: 27
    67. HiSight-RTSP-Encap:
    68. HiSight-RTSP-Encap: his_trigger_method: SETUP
    69. HiSight-RTSP-Encap:
    70. HiSight-RTSP-Encap: [70e58810d59716a, 2097119, 167b514] Sending setup response.
    71. HiSight-RTSP-Encap: [70e58810d59716a, 159983f, 0] Encapsulate common response RTSP/1.0 200 OK
    72. HiSight-RTSP-Encap: Date: 2022-11-08 16:18:29 PM Tue
    73. HiSight-RTSP-Encap: Server: localhost
    74. HiSight-RTSP-Encap: Cseq: 4
    75. HiSight-RTSP-Encap:
    76. HiSight-RTSP-Encap: [70e58810d59716a, c659ab, 0] Encapsulate common response RTSP/1.0 200 OK
    77. HiSight-RTSP-Encap: Date: 2022-11-08 16:19:04 PM Tue
    78. HiSight-RTSP-Encap: Server: localhost
    79. HiSight-RTSP-Encap: Cseq: 5
    80. HiSight-RTSP-Encap:
    1. HiSight-RTSP-Ctl: [70e58710d58f3e7, 3fd39c8, 0] Start device type 5, subtype 51,local 192.168.49***,remote 192.168.49***
    2. HiSight-RTSP-Ctl: [70e58810d59716a, 2765261, 0] On peer ready
    3. HiSight-RTSP-Ctl: [70e58810d59716a, 26234c2, 0] On request ANNOUNCE * RTSP/1.0
    4. HiSight-RTSP-Ctl: [70e58810d59716a, 26234c2, 0] AuthNeg: We rcv encrypt data aes128ctr, send data=aes128ctr, get version 1, get ControlAlgId = 1, get MediaAlgId = 1
    5. HiSight-RTSP-Ctl: [70e58810d59716a, 32156e4, 0] On response, State:11
    6. HiSight-RTSP-Ctl: [70e58810d59716a, 22a199e, 0] On response, State:1
    7. HiSight-RTSP-Ctl: [70e58810d59716a, 8eb963, 0] On request OPTIONS * RTSP/1.0
    8. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] On response, State:3
    9. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Sink HiSight version is 1.1
    10. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] device_type 5;subtype 51;
    11. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Sink device type 5 subtype 51
    12. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] His_video_formats: codecs 2;fps 60;gop 300;bitrate 3145728;vbr-min 1048576;vbr-max 5242880;dpi 0;scr-w 0;scr-h 0;width 1080;height 2400
    13. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] processSinkVideoCodecs, sourcecodecs: 2 sinkcodecs: 2 negcodecs: 2
    14. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Sink vbr-min 1048576 vbr-max 5242880
    15. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Sink bitrate 3145728
    16. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] neg video formats: codecs 2,fps 60,gop 300,bitrate 3145728,min-bitrate 1048576,max-bitrate 5242880,dpi 0,scr-width 0,scr-height 0,width 1080,height 2400
    17. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Sink feature: 101
    18. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Sink feature: 103
    19. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Sink audioCodecs 1 negotiated value 1
    20. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 1, determine str is left_point_down, localList index 0
    21. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 1, determine str is left_point_up, localList index 1
    22. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 1, determine str is left_move, localList index 2
    23. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 1, determine str is left_key_down, localList index 3
    24. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 1, determine str is left_key_up, localList index 4
    25. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 1, determine str is mouse_down, localList index 5
    26. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 1, determine str is mouse_up, localList index 6
    27. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 1, determine str is mouse_move, localList index 7
    28. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 1, determine str is vertical_wheel, localList index 8
    29. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 1, determine str is horizontal_wheel, localList index 9
    30. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 1, determine str is stylus, localList index -1
    31. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 3, determine str is input_content, localList index 0
    32. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 3, determine str is input_focus, localList index 1
    33. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 3, determine str is virtualkey_back, localList index 2
    34. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 3, determine str is virtualkey_home, localList index 3
    35. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 3, determine str is virtualkey_recent_app, localList index 4
    36. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 3, determine str is virtualkey_quick_setting, localList index 5
    37. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 3, determine str is message_extend, localList index 6
    38. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Determine Uibc listType 3, determine str is message_reserved, localList index 7
    39. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Negotiated UIBC result is true
    40. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Process network config, not carry his_network_config.
    41. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Peer support vtp for video, result is 1
    42. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] processModuleCustomParams in, controllerParams: null,mediaParams {"h265_supported":false,"slice_num_splice":false,"slice_num_advance":false,"max_inputbuffer_size_slice_num":1,"slice_size_splice":false,"slice_size_advance":false,"max_inputbuffer_size_slice_size":1,"none_slice":true,"pad_fps_optimization":true};
    43. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Module custom params negotiation done,send M4 request: 0
    44. HiSight-RTSP-Ctl: [70e58810d59716a, 2ad31c7, 0] Send M4 request,result: true
    45. HiSight-RTSP-Ctl: [70e58810d59716a, 3316272, 0] On response, State:4
    46. HiSight-RTSP-Ctl: [70e58810d59716a, 3316272, 0] Send action method is SETUP
    47. HiSight-RTSP-Ctl: [70e58810d59716a, 3a1caa8, 0] On response, State:5
    48. HiSight-RTSP-Ctl: [70e58810d59716a, 167b514, 0] On request SETUP * RTSP/1.0
    49. HiSight-RTSP-Ctl: [70e58810d59716a, 159983f, 0] On request PLAY * RTSP/1.0
    50. HiSight-RTSP-Ctl: [70e58810d59716a, 159983f, 0] Get vtp port is invalid.
    51. HiSight-RTSP-Ctl: [70e58810d59716a, c659ab, 0] On request PAUSE RTSP/1.0

    协商的日志中没有看到audio协商相关的信息,但是通过codec部分还是能看到音频的格式应该是aac,但是有意思的是创建了4个audio的子继承,这个还是可以深入了解的。

    1. CCodec : Created component [c2.android.aac.encoder]
    2. CCodec : Created component [c2.android.aac.encoder]
    3. CCodec : Created component [c2.android.aac.encoder]
    4. CCodec : Created component [c2.android.aac.encoder]

    互联设备中支持所有音频的扭转,所以这里音频采集的就不再是通过remotedevice了,因为remotedevice有部分声音是采集不到的,例如闹钟、电话声音等。从日志上看应该是从代理节点采集数据,这样子的话应该是所有的音频数据的采集都是走代理节点,audio 数据回写应该也是写到此节点,这部分的实现需要在系统中实现了。

    1. APM_AudioPolicyManager: setDeviceConnectionStateInt() device: 0x2000000, state 1, name DMSDP format 0x0
    2. APM_AudioPolicyManager: setDeviceConnectionStateInt() device: 0x2000000, state 1, name DMSDP format 0x0
    3. APM_AudioPolicyManager: setDeviceConnectionStateInt() device: 0x81000000, state 1, name DMSDP format 0x0
    4. APM_AudioPolicyManager: setDeviceConnectionStateInt() device: 0x81000000, state 1, name DMSDP format 0x0

        视频采集编码部分可以看看如下部分,还是通过virtualdisplay获取当前屏幕数据,设置宽高、dpi,根据协商设置比特率,编码部分走的ACODEC没什么日志,画面静止后转为动画瞬间并没有呼吸效应画面很流畅,这里的qp参数应该有部分的调整,应该走的是VBR。而且画面静止转动画后会对网络有比较大的冲击,容易出现音频的卡顿,而这里都是很顺畅,应该在网络发包做了调优。然后统计每秒的视频帧率,从统计的帧率看并没有稳定60fps,并不需要将输出帧率固定再60fps。

    1. 16:18:29.759 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] VideoEncoder Constructor in, deviceType is 5, deviceSubType is 51
    2. 16:18:29.759 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] DefaultVideoBitrate is : 8.0Mbps, minVideoBitrate is 3.0Mbps, maxVideoBitrate is 10.0Mbps
    3. 16:18:29.759 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] VideoEncoder Constructor out
    4. 16:18:29.759 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] setVideoEncoderWidthHeight in, width is 1080, height is 2400, multiWindowMode is 0
    5. 16:18:29.759 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] setVirtualDisplayDpi : 480
    6. 16:18:29.759 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] updateVideoFps in, currentFps : 30, newFps : 60
    7. 16:18:29.759 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] setVideoIframeInterval : 5.0
    8. 16:18:29.759 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] set invalid screen width : 0, height : 0
    9. 16:18:29.759 10298 32091 E HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] ERROR : set invalid screen size
    10. 16:18:29.759 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] setVirtualDisplayName new name : HiSightPCDisplay
    11. 16:18:29.759 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] setVirtualDisplayType : 3
    12. 16:18:29.759 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] setMinMaxVideoBitrate in, minVideoBitrate is : 1.0Mbps, maxVideoBitrate is : 5.2Mbps
    13. 16:18:29.759 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] setDefaultVideoBitrate in, currBitrate is : 3.1Mbps
    14. 16:18:29.759 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] setVideoEncoderType type : video/hevc
    15. 16:18:29.759 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] prepareVideoEncoder in
    16. 16:18:29.759 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] initCallbackHandlerThread in.
    17. 16:18:29.763 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] prepareVideoEncoderForMatebookOrPad in.
    18. 16:18:29.767 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] prepareVideoEncoderForMatebookOrPad out.
    19. 16:18:29.825 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] getSecondaryScreenWidth in.
    20. 16:18:29.825 10298 32091 E HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] not hw fold display.
    21. 16:18:29.825 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] getCurrentRotation in
    22. 16:18:29.825 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] getCurrentRotation invoke success, mCurrRotation is 0
    23. 16:18:29.825 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] updateDisplayAndVideoResolution in
    24. 16:18:29.826 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] updateResolutionInStandardScreen in
    25. 16:18:29.826 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] updateResolutionInStandardScreen out
    26. 16:18:29.826 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] updateDisplayAndVideoResolution out, currRotation: 0, currDisplayMode: 0, mCurrentVideoWidth: 1080, mCurrentVideoHeight: 2400, mVideoWith: 1080, mVideoHeight: 2400
    27. 16:18:29.826 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] judgeDeviceRotated out, currRotation: 0, currVideoWidth: 1080, currVideoHeight: 2400, mVideoWith: 1080, mVideoHeight: 2400, mInitialVideoWidth: 1080, mInitialVideoHeight: 2400
    28. 16:18:29.904 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] create VirtualDisplay VirtualDisplay{display=Display id 47: DisplayInfo{"HiSightPCDisplay, displayId 47", uniqueId "****", app 1080 x 2400, real 1080 x 2400, largest app 1080 x 2400, smallest app 1080 x 2400, mode 48, defaultMode 48, modes [{id=48, width=1080, height=2400, fps=60.0}], colorMode 0, supportedColorModes [0], hdrCapabilities null, rotation 0, density 480 (480.0 x 480.0) dpi, layerStack 47, appVsyncOff 0, presDeadline 16666666, type VIRTUAL, state ON, owner com.huawei.android.airsharing (uid 1000), FLAG_PRESENTATION, removeMode 0}, DisplayMetrics{density=3.0, width=1080, height=2400, scaledDensity=3.0, xdpi=480.0, ydpi=480.0, densityDpi=480, noncompatWidthPixels=1080, noncompatHeightPixels=2400, noncompatDensity=3.0, noncompatDensityDpi=480, noncompatXdpi=480.0, noncompatYdpi=480.0}, isValid=true, token=android.hardware.display.DisplayManagerGlobal$VirtualDisplayCallback@e7fb9c8, surface=Surface(name=null)/@0xfad3a61}
    29. 16:18:29.911 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] checkDeviceHasNavigationBar in
    30. 16:18:29.912 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] checkDeviceHasNavigationBar out, noNavigationBar
    31. 16:18:29.914 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, e9beb4, cd8fa8] suspendVideoEncoder in
    32. 16:18:29.914 10298 32136 I HiSight-M-EncoderVideo: [70e58810d59716a, 1a5a32a, e9beb4] handle message: 5, displayMode is 0, mMultiWindowMode is 0
    33. 16:18:29.914 10298 32136 I HiSight-M-EncoderVideo: [70e58810d59716a, 1a5a32a, e9beb4] suspendVideoEncodeInner in
    34. 16:18:29.917 10298 32091 I HiSight-M-EncoderVideo: [70e58810d59716a, 2a42af1, 159983f] resumeVideoEncoder in
    35. 16:18:29.917 10298 32136 I HiSight-M-EncoderVideo: [70e58810d59716a, 70f5f8, 2a42af1] handle message: 4, displayMode is 0, mMultiWindowMode is 0
    36. 16:18:29.917 10298 32136 I HiSight-M-EncoderVideo: [70e58810d59716a, 70f5f8, 2a42af1] resumeVideoEncoderInner in
    37. 16:18:29.917 10298 32136 I HiSight-M-EncoderVideo: [70e58810d59716a, 70f5f8, 2a42af1] Is First Resume, no need IDRRequest
    38. 16:18:29.918 10298 32136 I HiSight-M-EncoderVideo: [70e58810d59716a, 70f5f8, 2a42af1] Screen is not Locked.
    39. 16:18:29.918 10298 32136 I HiSight-M-EncoderVideo: [70e58810d59716a, 70f5f8, 2a42af1] resumeVideoEncoderInner out
    40. 16:18:29.923 10298 32153 I HiSight-M-EncoderVideo: We have got 0 frames from Encoder.
    41. 16:18:30.058 10298 32145 I HiSight-M-EncoderVideo: MediaCodec Callback onOutputFormatChanged
    42. 16:18:30.058 10298 32145 I HiSight-M-EncoderVideo: onOutputFormatChanged, new MediaFormat : {max-bitrate=3145728, vendor.hisi.SupportHvc=0, vendor.hisi.hisi-ext-codec-perceptual-coding-supported=2, mime=video/hevc, vendor.hisi.LowBitrate=2, vendor.hisi.hisi-ext-codec-scale-supported=1, bitrate=3145728, vendor.hisi.SupportMoreLTRF=0, vendor.hisi.hisi-ext-codec-crop-supported=1, vendor.hisi.hisi-ext-codec-qp-regulation-supported=1, color-standard=1, vendor.hisi.hisi-ext-codec-ltr-supported=1, color-transfer=3, width=1080, vendor.hisi.hisi-ext-codec-roi-supported=1, vendor.hisi.hisi-ext-codec-non-ref-p-frames-supported=1, vendor.hisi.hisi-ext-codec-more-ltr-supported=0, color-range=2, frame-rate=60, height=2400, csd-0=java.nio.HeapByteBuffer[pos=0 lim=87 cap=87]}
    43. 16:18:30.924 10298 32153 I HiSight-M-EncoderVideo: We have got 34 frames from Encoder.
    44. 16:18:31.924 10298 32153 I HiSight-M-EncoderVideo: We have got 39 frames from Encoder.

    其实互联实现还是比较佩服拖拽的体验效果的,因为在平板端拖拽,无延迟的体验确实挺牛的,之前在wfd实现UIBC时有时候都会顿一下,体验很不爽。文件拖拽需要配合文件管理器进行修改了,数据传输、控制部分还是在互联的进程中由UIBC进行控制。

    1. JNI_FT_SOCKET: FillpAdpDebugSend : 91 1108 16:18:29.723695 fillp_conn.c:393,FillpConnReqAckInput <F-LOGBUTT>FillpConnReqAckInput IN
    2. JNI_FT_SOCKET: FillpAdpDebugSend : 91 1108 16:18:29.723733 fillp_conn.c:1545,FillpSendConnConfirm <F-LOGBUTT>FillpSendConnConfirm IN
    3. JNI_FT_SOCKET: FillpAdpDebugSend : 91 1108 16:18:29.723865 fillp_conn.c:1672,FillpSendConnConfirm <F-LOGBUTT>FillpSendConnConfirm OUT
    4. JNI_FT_SOCKET: FillpAdpDebugSend : 91 1108 16:18:29.723880 fillp_conn.c:476,FillpConnReqAckInput <F-LOGBUTT>FillpConnReqAckInput OUT
    5. JNI_FT_SOCKET: FillpAdpDebugSend : 91 1108 16:18:29.746591 fillp_conn.c:947,FillpConnConfirmAckInput <F-LOGBUTT>FillpConnConfirmAckInput IN
    6. JNI_FT_SOCKET: FillpAdpDebugSend : 91 1108 16:18:29.750140 fillp_flow_control.c:464,FillpFcInit <F-LOGERR>fillp_sock_id:0, fc alg:4h, characters:1h, peer_alg:7h, peerCharacters:1h
    7. JNI_FT_SOCKET: FillpAdpDebugSend : 91 1108 16:18:29.751809 fillp_conn.c:787,FillpHandleConnConfirmAckInput <F-LOGBUTT>FillpHandleConnConfirmAckInput IN
    8. JNI_FT_SOCKET: FillpAdpDebugSend : 91 1108 16:18:29.752039 fillp_conn.c:811,FillpHandleConnConfirmAckInput <F-LOGBUTT>FillpHandleConnConfirmAckInput OUT
    9. JNI_FT_SOCKET: FillpAdpDebugSend : 91 1108 16:18:29.752070 fillp_conn.c:1076,FillpConnConfirmAckInput <F-LOGBUTT>FillpConnConfirmAckInput OUT

    再看看平板端的日志,上来先是DMSDP的初始化(第一眼看还是以为是DMS,后面网上查了下是HarmonyOS设备虚拟化),其实更关注的是camera 数据采集后,数据如何填充到手机端。

    1. DMSDP : DMSDPService:DMSDPService onCreate
    2. DMSDP : SinkProfile:SinkProfile util construct
    3. DMLog : DeviceManager:set flags:3, countryCode:
    4. AwareBitmapCacher: init processName:com.hihonor.dmsdp pid=28270 uid=1000
    5. DMSDP : SinkProfile:execute to connect sink profile service
    6. DMLog : RemoteServiceConnection:begin to bind service:ComponentInfo{com.hihonor.iconnect/com.hihonor.devicemanager.service.CloudDeviceManagerService}
    7. ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.bindService:2026 android.content.ContextWrapper.bindService:812 com.hihonor.devicemanager.client.a.a:147 com.hihonor.dmsdpdevice.a.c:1277 com.hihonor.dmsdpdevice.a.lambda$gmGC7SawuKKi_8Jc3ls7Xp-b3ZE:0
    8. CamSDK_CameraJniInit: JNI_OnLoad: begin load Camera JNI
    9. CamSDK_CameraJniInit: JNI_OnLoad: load jni so success
    10. RasterMill: RegisterAndroidCameraJniUtil: Start Register Android Camera Jni Util
    11. RasterMill: RegisterNativeCameraJniUtil: Start Register Native Camera Jni Util
    12. DMSDP : CamSDK_CameraModuleUtils:register camera jni util
    13. DMSDP : CamSDK_CameraModuleUtils:register camera status handler
    14. DMSDP : DMSDPService:registerReceiver
    15. DMSDP : DMSDPService:created from userUnlocked
    16. DMSDP : DMSDPService:init
    17. DMSDP : DMSDPController:init
    18. DMSDP : DiscoverManager:init
    19. DMSDP : DMSDPDeviceManager:init
    20. DMSDP : SoftBusChannel sink:SoftBusChannel init
    21. NearbyInterface: getServiceFromManager: DdmpDataBusService
    22. NearbyInterface: put entryMap, name=com.hihonor.dmsdp+dmsdpsession+server
    23. NearbyInterface: addEntry: succ=true name=com.hihonor.dmsdp+dmsdpsession+server
    24. DMSDP : softBusManager:createSessionServer:com.hihonor.dmsdp com.hihonor.dmsdp+dmsdpsession+server ret:0 isServer: true

    协商过程的跟手机端类似没什么好看的,但是到解码这边的我就有那么点点看不懂了,前面大家握手商量的是是60帧,这咋说变就变变成30帧了,总觉得哪里不对,但是不知道哪里出错了。

    1. I CCodec : setup formats input: AMessage(what = 0x00000000) = {
    2. I CCodec : int32_t max-input-size = 5242880
    3. I CCodec : int32_t width = 1080
    4. I CCodec : int32_t priority = 0
    5. I CCodec : string mime = "video/hevc"
    6. I CCodec : int32_t frame-rate = 30
    7. I CCodec : int32_t height = 2400
    8. I CCodec : int32_t level = 131072
    9. I CCodec : Rect crop(0, 0, 318, 238)
    10. I CCodec : }
    11. I CCodec : setup formats output: AMessage(what = 0x00000000) = {
    12. I CCodec : int32_t android._color-format = 2130708361
    13. I CCodec : int32_t android._video-scaling = 1
    14. I CCodec : int32_t sar-width = 1
    15. I CCodec : int32_t color-standard = 4
    16. I CCodec : int32_t color-range = 2
    17. I CCodec : int32_t color-transfer = 3
    18. I CCodec : int32_t android._dataspace = 259
    19. I CCodec : int32_t width = 1080
    20. I CCodec : int32_t rotation-degrees = 0
    21. I CCodec : int32_t sar-height = 1
    22. I CCodec : int32_t max-width = 320
    23. I CCodec : int32_t max-height = 240
    24. I CCodec : int32_t priority = 0
    25. I CCodec : string mime = "video/raw"
    26. I CCodec : Rect crop(0, 0, 318, 238)
    27. I CCodec : Buffer hdr-static-info = {
    28. I CCodec : 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
    29. I CCodec : 00000010: 00 00 00 00 00 00 00 00 00 .........
    30. I CCodec : }
    31. I CCodec : int32_t frame-rate = 30
    32. I CCodec : int32_t height = 2400
    33. I CCodec : int3

    另外通过日志可以发如果画面是静止的,就会出现如下打印,那应该也是说明静止画面下其实源端是没有数据传输过来的,所以源端没有保证输出帧率是60fps。

     HiSight-M-DecoderFast: Notice : unable to dequeueOutputBuffer

    抓空中包可以看到音频数据跟视频数据是两个socket在传输。如果是自己写demo玩,可以传裸流,如果是产品话还是应该进行加密。

    多屏协同的延时在50ms左右,这个延时体验国内已经是业内标杆了。关于优化部分,从日志上看不出什么有用信息了,只能自己根据延时去拆了。有优化空间的模块:视频编码优化、策略发包、数据接收、rtcp策略、音视频渲染,都会有调优的空间,不过UIBC反控无感延迟,个人还是觉得比50ms延迟难的多。有空了自己写demo,在相同的手机平板上试试投屏延时能到多少。

    这里很多逻辑都是根据日志推测的可能有很多是不准确的哈,有兴趣的自己拿设备深入分析哈。反正性能调优还是只能靠自己。

  • 相关阅读:
    【Cheat Engine7.5】基础教程第三关(步骤4)
    真正“搞”懂HTTP协议14之HTTP3
    Linux运维常用小总结
    【AI可视化---04】点亮数据之旅:发现Matplotlib的奇幻绘图世界!用Python挥洒数据音符的创意乐章——这四篇就够了!
    做好了产品需求管理,PM就不用挨揍了吗?
    百度低质量站点怎么办?解决百度低质量站点的方法和工具
    C++ 用户学习 Python 的最佳方法
    Java设计模式中策略模式
    python运算符重载之构造函数和迭代器
    opencv学习之边缘检测
  • 原文地址:https://blog.csdn.net/mengxin00100/article/details/126935627