Skip to content

Commit 052a1fa

Browse files
committed
修改xp2p版本2.4.40, startService添加超时tcp切换时间参数。
Change-Id: I6c39d4943f93718f818a9379f8482c89061a85ef
1 parent 64e7e5e commit 052a1fa

File tree

10 files changed

+26
-24
lines changed

10 files changed

+26
-24
lines changed

sdk/video-link-android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ dependencies {
4848
// changing = true
4949
// }
5050
// api 'com.tencent.iot.thirdparty.android:xp2p-sdk:2.4.23'
51-
api 'com.tencent.iot.thirdparty.android:xp2p-sdk:2.4.38'
51+
api 'com.tencent.iot.thirdparty.android:xp2p-sdk:2.4.40'
5252
api 'com.tencent.iot.thirdparty.android:media-server:1.0.5'
5353
api 'io.github.sundoggynew:iot-soundtouch:1.0.0'
5454
api 'io.github.sundoggynew:iot-voice-changer:1.0.0'

sdk/video-link-android/doc/VideoSDK接入说明.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ setUserCallbackToXp2p(_av_data_recv, _msg_notify);
211211
* 接口描述:
212212
初始化xp2p服务。
213213
```
214-
int startServiceWithXp2pInfo(const char* id, const char *product_id, const char *device_name, const char* xp2p_info);
214+
int startServiceWithXp2pInfo(const char* id, const char *product_id, const char *device_name, const char* xp2p_info, int sensor_timeout);
215215
```
216216

217217
| 参数 | 类型 | 描述 | 输入/输出 |
@@ -233,7 +233,7 @@ const char* xp2p_info = getXP2PInfo(...);
233233
/* 设置回调函数 */
234234
setUserCallbackToXp2p(_av_data_recv, _msg_notify);
235235
/* 初始化p2p */
236-
startServiceWithXp2pInfo($id, $product_id, $device_name, xp2p_info);
236+
startServiceWithXp2pInfo($id, $product_id, $device_name, xp2p_info, sensor_timeout);
237237
```
238238

239239
##### 2.1.3 P2P通道传输音视频裸流
@@ -562,7 +562,7 @@ void sample() {
562562
int ret = 0;
563563
564564
START:
565-
ret = startServiceWithXp2pInfo($id, $product_id, $device_name, $xp2p_info);
565+
ret = startServiceWithXp2pInfo($id, $product_id, $device_name, $xp2p_info $sensor_timeout);
566566
if (ret < 0>) {
567567
printf("p2p start error\n");
568568
return;
@@ -617,7 +617,7 @@ void sample() {
617617
int ret = 0;
618618
619619
START:
620-
ret = startServiceWithXp2pInfo($id, $product_id, $device_name, $xp2p_info);
620+
ret = startServiceWithXp2pInfo($id, $product_id, $device_name, $xp2p_info, $sensor_timeout);
621621
if (ret < 0>) {
622622
printf("p2p start error\n");
623623
return;
@@ -774,7 +774,7 @@ class VideoActivity : XP2PCallback {
774774
* 接口描述:
775775
初始化xp2p服务。
776776
```
777-
public static void startServiceWithXp2pInfo(String id, String product_id, String device_name, String xp2p_info)
777+
public static void startServiceWithXp2pInfo(String id, String product_id, String device_name, String xp2p_info, int sensor_timeout)
778778
```
779779

780780
| 参数 | 类型 | 描述 | 输入/输出 |
@@ -783,6 +783,7 @@ public static void startServiceWithXp2pInfo(String id, String product_id, String
783783
| product_id | String | 目标camera产品信息 | 输入 |
784784
| device_name | String | 目标camera设备名称 | 输入 |
785785
| xp2p_info | String | xp2p信息 | 输入 |
786+
| sensor_timeout | int | 超时tcp切换时间 | 输入 |
786787

787788
| 返回值 | 描述 |
788789
|:-|:-|
@@ -795,7 +796,7 @@ String xp2p_info = getXP2PInfo(...)
795796
/* 设置回调 */
796797
XP2P.setCallback(this)
797798
/* 初始化p2p */
798-
XP2P.startServiceWithXp2pInfo($id, $product_id, $device_name, xp2p_info)
799+
XP2P.startServiceWithXp2pInfo($id, $product_id, $device_name, xp2p_info, sensor_timeout)
799800
```
800801

801802
##### 2.2.3 P2P通道传输音视频裸流
@@ -1032,5 +1033,5 @@ override fun onDestroy() {
10321033
10331034
String xp2p_info = getXP2PInfo(...) // 从自建后台获取xp2p info
10341035
XP2P.setCallback(this)
1035-
XP2P.startServiceWithXp2pInfo(id, product_id, device_name, xp2p_info)
1036+
XP2P.startServiceWithXp2pInfo(id, product_id, device_name, xp2p_info, sensor_timeout)
10361037
```

sdk/video-link-android/doc/VideoSDK接口说明.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
### 接口说明
66
1. 初始化xp2p服务接口
7-
> int startService(String id, String product_id, String device_name)
7+
> int startService(String id, String product_id, String device_name, int sensor_timeout)
88
99
| 参数 | 类型 | 描述 |
1010
|:-|:-|:-|
1111
| id | String | 目标camera在app端的唯一标识符,可以使用产品信息和设备名称组合,如:"$product/$device_name" |
1212
| product_id | String | 产品ID |
1313
| device_name | String | 设备名称 |
14+
| sensor_timeout | int | 超时tcp切换时间 |
1415

1516
| 返回值 | 描述 |
1617
|:-|:-|
@@ -342,6 +343,6 @@ DeviceServerInfo 定义如下
342343
...
343344
String xp2p_info = getXP2PInfo(...) // 从自建后台获取xp2p info
344345
XP2P.setCallback(this)
345-
XP2P.startService(id, product_id, device_name)
346+
XP2P.startService(id, product_id, device_name, sensor_timeout)
346347
XP2P.setParamsForXp2pInfo(deviceId, "", "", xp2pInfo)
347348
```

sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/video/nvr/VideoNvrActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class VideoNvrActivity : VideoBaseActivity(), DevsAdapter.OnItemClicked, XP2PCal
8888
App.data.accessInfo?.let {
8989
countDownLatch = CountDownLatch(1)
9090
var started = XP2P.startServiceWithXp2pInfo("${it.productId}/${devName}",
91-
it.productId, devName, "")
91+
it.productId, devName, "", 5)
9292
if (started != 0) return@launch
9393

9494
countDownLatch.await(5, TimeUnit.SECONDS)

sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/video/playback/localPlayback/VideoLocalPlaybackFragment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ class VideoLocalPlaybackFragment : VideoPlaybackBaseFragment(), TextureView.Surf
612612
var id = "${App.data.accessInfo?.productId}/${devInfo?.DeviceName}"
613613
var started = XP2P.startServiceWithXp2pInfo(
614614
id,
615-
App.data.accessInfo?.productId, devInfo?.DeviceName, ""
615+
App.data.accessInfo?.productId, devInfo?.DeviceName, "",5
616616
)
617617
if (started != 0) {
618618
launch(Dispatchers.Main) {
@@ -658,7 +658,7 @@ class VideoLocalPlaybackFragment : VideoPlaybackBaseFragment(), TextureView.Surf
658658
id,
659659
App.data.accessInfo!!.productId,
660660
devInfo?.DeviceName,
661-
""
661+
"", 5
662662
) != 0
663663
) {
664664
XP2P.stopService(id)

sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/video/preview/VideoMultiPreviewActivity.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class VideoMultiPreviewActivity : VideoBaseActivity(), XP2PCallback, CoroutineSc
113113
Thread(Runnable {
114114
var id = "${App.data.accessInfo!!.productId}/${devName}"
115115
var started = XP2P.startServiceWithXp2pInfo(id,
116-
App.data.accessInfo!!.productId, devName, "")
116+
App.data.accessInfo!!.productId, devName, "", 5)
117117
// 已经启动过,或者第一次启动,继续进行
118118
if (started != 0 && started != -1011) {
119119
launch(Dispatchers.Main) {
@@ -281,13 +281,13 @@ class VideoMultiPreviewActivity : VideoBaseActivity(), XP2PCallback, CoroutineSc
281281
if (!playerHolder.keepAliveThreadRuning) break //锁被释放后,检查守护线程是否继续运行
282282

283283
// 发现断开尝试恢复视频,每隔一秒尝试一次
284-
var flag = XP2P.startServiceWithXp2pInfo(id, App.data.accessInfo!!.productId, playerHolder.devName, "")
284+
var flag = XP2P.startServiceWithXp2pInfo(id, App.data.accessInfo!!.productId, playerHolder.devName, "", 5)
285285
while (flag != 0 && flag != -1011) {
286286
// XP2P.stopService(id)
287287
synchronized(objectLock) {
288288
objectLock.wait(1000)
289289
}
290-
flag = XP2P.startServiceWithXp2pInfo(id, App.data.accessInfo!!.productId, playerHolder.devName, "")
290+
flag = XP2P.startServiceWithXp2pInfo(id, App.data.accessInfo!!.productId, playerHolder.devName, "", 5)
291291
}
292292

293293
Log.d(tag, "index=${id!!}/${channel} keepPlayerplay countDownLatch wait ")

sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/video/preview/VideoPreviewActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class VideoPreviewActivity : VideoBaseActivity(), EventView, TextureView.Surface
145145

146146
XP2P.setCallback(this)
147147
XP2P.startService("${App.data.accessInfo!!.productId}/${presenter.getDeviceName()}",
148-
App.data.accessInfo!!.productId, presenter.getDeviceName()
148+
App.data.accessInfo!!.productId, presenter.getDeviceName(), 5
149149
)
150150

151151
//实例化对象并设置监听器
@@ -215,7 +215,7 @@ class VideoPreviewActivity : VideoBaseActivity(), EventView, TextureView.Surface
215215
// 发现断开尝试恢复视频,每隔一秒尝试一次
216216
Log.d(tag, "====开始尝试重连...")
217217
XP2P.stopService(id)
218-
while (XP2P.startService(id, App.data.accessInfo!!.productId, presenter.getDeviceName())!=0
218+
while (XP2P.startService(id, App.data.accessInfo!!.productId, presenter.getDeviceName(), 5)!=0
219219
|| XP2P.setParamsForXp2pInfo(id, accessId, accessToken, "") != 0
220220
|| getDeviceStatus(id) != 0) {
221221
XP2P.stopService(id)

sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/video/preview/VideoPreviewMJPEGActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class VideoPreviewMJPEGActivity : VideoBaseActivity(), EventView, TextureView.Su
143143

144144
XP2P.setCallback(this)
145145
XP2P.startService("${App.data.accessInfo!!.productId}/${presenter.getDeviceName()}",
146-
App.data.accessInfo!!.productId, presenter.getDeviceName()
146+
App.data.accessInfo!!.productId, presenter.getDeviceName(), 5
147147
)
148148

149149
//实例化对象并设置监听器
@@ -213,7 +213,7 @@ class VideoPreviewMJPEGActivity : VideoBaseActivity(), EventView, TextureView.Su
213213
// 发现断开尝试恢复视频,每隔一秒尝试一次
214214
Log.d(tag, "====开始尝试重连...")
215215
XP2P.stopService(id)
216-
while (XP2P.startService(id, App.data.accessInfo!!.productId, presenter.getDeviceName())!=0
216+
while (XP2P.startService(id, App.data.accessInfo!!.productId, presenter.getDeviceName(), 5)!=0
217217
|| XP2P.setParamsForXp2pInfo(id, accessId, accessToken, "") != 0
218218
|| getDeviceStatus(id) != 0) {
219219
XP2P.stopService(id)

sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/video/preview/VideoPushStreamActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class VideoPushStreamActivity : VideoBaseActivity(), EventView, TextureView.Surf
128128

129129
XP2P.setCallback(this)
130130
XP2P.startService("${App.data.accessInfo!!.productId}/${presenter.getDeviceName()}",
131-
App.data.accessInfo!!.productId, presenter.getDeviceName()
131+
App.data.accessInfo!!.productId, presenter.getDeviceName(), 5
132132
)
133133

134134
holder = sv_camera_view.holder
@@ -220,7 +220,7 @@ class VideoPushStreamActivity : VideoBaseActivity(), EventView, TextureView.Surf
220220
// 发现断开尝试恢复视频,每隔一秒尝试一次
221221
Log.d(tag, "====开始尝试重连...")
222222
XP2P.stopService(id)
223-
while (XP2P.startService(id, App.data.accessInfo!!.productId, presenter.getDeviceName())!=0
223+
while (XP2P.startService(id, App.data.accessInfo!!.productId, presenter.getDeviceName(), 5)!=0
224224
|| XP2P.setParamsForXp2pInfo(id, accessId, accessToken, "") != 0
225225
|| getDeviceStatus(id) != 0) {
226226
XP2P.stopService(id)

sdkdemo/src/main/java/com/tencent/iot/explorer/link/demo/video/preview/VideoWithoutPropertyActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class VideoWithoutPropertyActivity : VideoBaseActivity(), EventView, TextureView
152152

153153
XP2P.setCallback(this)
154154
XP2P.startService("${App.data.accessInfo!!.productId}/${presenter.getDeviceName()}",
155-
App.data.accessInfo!!.productId, presenter.getDeviceName()
155+
App.data.accessInfo!!.productId, presenter.getDeviceName(), 5
156156
)
157157

158158
val wm = this.getSystemService(WINDOW_SERVICE) as WindowManager
@@ -257,7 +257,7 @@ class VideoWithoutPropertyActivity : VideoBaseActivity(), EventView, TextureView
257257
// 发现断开尝试恢复视频,每隔一秒尝试一次
258258
Log.d(tag, "====开始尝试重连...")
259259
XP2P.stopService(id)
260-
while (XP2P.startService(id, App.data.accessInfo!!.productId, presenter.getDeviceName())!=0
260+
while (XP2P.startService(id, App.data.accessInfo!!.productId, presenter.getDeviceName(), 5)!=0
261261
|| XP2P.setParamsForXp2pInfo(id, accessId, accessToken, "") != 0
262262
|| getDeviceStatus(id) != 0) {
263263
XP2P.stopService(id)

0 commit comments

Comments
 (0)