Skip to content

Commit

Permalink
容灾缓存配置
Browse files Browse the repository at this point in the history
Change-Id: Ie7cb8807f94eab4859325b92389d5bc751e3a307
  • Loading branch information
SundoggyNew committed Dec 21, 2023
1 parent c05f268 commit 91a5374
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class VideoNvrActivity : VideoBaseActivity(), DevsAdapter.OnItemClicked, XP2PCal

App.data.accessInfo?.let {
countDownLatch = CountDownLatch(1)
var started = XP2P.startServiceWithXp2pInfo("${it.productId}/${devName}",
it.productId, devName, "", 5)
var started = XP2P.startServiceWithXp2pInfo(this@VideoNvrActivity, "${it.productId}/${devName}",
it.productId, devName, "")
if (started != 0) return@launch

countDownLatch.await(5, TimeUnit.SECONDS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,9 +619,9 @@ class VideoLocalPlaybackFragment : VideoPlaybackBaseFragment(), TextureView.Surf

Thread(Runnable {
var id = "${App.data.accessInfo?.productId}/${devInfo?.DeviceName}"
var started = XP2P.startServiceWithXp2pInfo(
var started = XP2P.startServiceWithXp2pInfo(context,
id,
App.data.accessInfo?.productId, devInfo?.DeviceName, "",5
App.data.accessInfo?.productId, devInfo?.DeviceName, ""
)
if (started != 0) {
launch(Dispatchers.Main) {
Expand Down Expand Up @@ -663,11 +663,11 @@ class VideoLocalPlaybackFragment : VideoPlaybackBaseFragment(), TextureView.Surf

// 发现断开尝试恢复视频,每隔一秒尝试一次
XP2P.stopService(id)
while (XP2P.startServiceWithXp2pInfo(
while (XP2P.startServiceWithXp2pInfo(context,
id,
App.data.accessInfo!!.productId,
devInfo?.DeviceName,
"", 5
""
) != 0
) {
XP2P.stopService(id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ class VideoMultiPreviewActivity : VideoBaseActivity(), XP2PCallback, CoroutineSc
private fun setPlayerSource(player: IjkMediaPlayer, devName: String, channel: Int) {
Thread(Runnable {
var id = "${App.data.accessInfo!!.productId}/${devName}"
var started = XP2P.startServiceWithXp2pInfo(id,
App.data.accessInfo!!.productId, devName, "", 5)
var started = XP2P.startServiceWithXp2pInfo(this@VideoMultiPreviewActivity, id,
App.data.accessInfo!!.productId, devName, "")
// 已经启动过,或者第一次启动,继续进行
if (started != 0 && started != -1011) {
launch(Dispatchers.Main) {
Expand Down Expand Up @@ -281,13 +281,13 @@ class VideoMultiPreviewActivity : VideoBaseActivity(), XP2PCallback, CoroutineSc
if (!playerHolder.keepAliveThreadRuning) break //锁被释放后,检查守护线程是否继续运行

// 发现断开尝试恢复视频,每隔一秒尝试一次
var flag = XP2P.startServiceWithXp2pInfo(id, App.data.accessInfo!!.productId, playerHolder.devName, "", 5)
var flag = XP2P.startServiceWithXp2pInfo(this@VideoMultiPreviewActivity, id, App.data.accessInfo!!.productId, playerHolder.devName, "")
while (flag != 0 && flag != -1011) {
// XP2P.stopService(id)
synchronized(objectLock) {
objectLock.wait(1000)
}
flag = XP2P.startServiceWithXp2pInfo(id, App.data.accessInfo!!.productId, playerHolder.devName, "", 5)
flag = XP2P.startServiceWithXp2pInfo(this@VideoMultiPreviewActivity, id, App.data.accessInfo!!.productId, playerHolder.devName, "")
}

Log.d(tag, "index=${id!!}/${channel} keepPlayerplay countDownLatch wait ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ class VideoPreviewActivity : VideoBaseActivity(), EventView, TextureView.Surface
}

XP2P.setCallback(this)
XP2P.startService("${App.data.accessInfo!!.productId}/${presenter.getDeviceName()}",
App.data.accessInfo!!.productId, presenter.getDeviceName(), 5
XP2P.startService(this@VideoPreviewActivity, "${App.data.accessInfo!!.productId}/${presenter.getDeviceName()}",
App.data.accessInfo!!.productId, presenter.getDeviceName()
)

//实例化对象并设置监听器
Expand Down Expand Up @@ -217,7 +217,7 @@ class VideoPreviewActivity : VideoBaseActivity(), EventView, TextureView.Surface
// 发现断开尝试恢复视频,每隔一秒尝试一次
Log.d(tag, "====开始尝试重连...")
XP2P.stopService(id)
while (XP2P.startService(id, App.data.accessInfo!!.productId, presenter.getDeviceName(), 5)!=0
while (XP2P.startService(this@VideoPreviewActivity, id, App.data.accessInfo!!.productId, presenter.getDeviceName())!=0
|| XP2P.setParamsForXp2pInfo(id, accessId, accessToken, "") != 0
|| getDeviceStatus(id) != 0) {
XP2P.stopService(id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ class VideoPreviewMJPEGActivity : VideoBaseActivity(), EventView, TextureView.Su
}

XP2P.setCallback(this)
XP2P.startService("${App.data.accessInfo!!.productId}/${presenter.getDeviceName()}",
App.data.accessInfo!!.productId, presenter.getDeviceName(), 5
XP2P.startService(this@VideoPreviewMJPEGActivity, "${App.data.accessInfo!!.productId}/${presenter.getDeviceName()}",
App.data.accessInfo!!.productId, presenter.getDeviceName()
)

//实例化对象并设置监听器
Expand Down Expand Up @@ -213,7 +213,7 @@ class VideoPreviewMJPEGActivity : VideoBaseActivity(), EventView, TextureView.Su
// 发现断开尝试恢复视频,每隔一秒尝试一次
Log.d(tag, "====开始尝试重连...")
XP2P.stopService(id)
while (XP2P.startService(id, App.data.accessInfo!!.productId, presenter.getDeviceName(), 5)!=0
while (XP2P.startService(this@VideoPreviewMJPEGActivity, id, App.data.accessInfo!!.productId, presenter.getDeviceName())!=0
|| XP2P.setParamsForXp2pInfo(id, accessId, accessToken, "") != 0
|| getDeviceStatus(id) != 0) {
XP2P.stopService(id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ class VideoPushStreamActivity : VideoBaseActivity(), EventView, TextureView.Surf
}

XP2P.setCallback(this)
XP2P.startService("${App.data.accessInfo!!.productId}/${presenter.getDeviceName()}",
App.data.accessInfo!!.productId, presenter.getDeviceName(), 5
XP2P.startService(this@VideoPushStreamActivity, "${App.data.accessInfo!!.productId}/${presenter.getDeviceName()}",
App.data.accessInfo!!.productId, presenter.getDeviceName()
)

holder = sv_camera_view.holder
Expand Down Expand Up @@ -220,7 +220,7 @@ class VideoPushStreamActivity : VideoBaseActivity(), EventView, TextureView.Surf
// 发现断开尝试恢复视频,每隔一秒尝试一次
Log.d(tag, "====开始尝试重连...")
XP2P.stopService(id)
while (XP2P.startService(id, App.data.accessInfo!!.productId, presenter.getDeviceName(), 5)!=0
while (XP2P.startService(this@VideoPushStreamActivity, id, App.data.accessInfo!!.productId, presenter.getDeviceName())!=0
|| XP2P.setParamsForXp2pInfo(id, accessId, accessToken, "") != 0
|| getDeviceStatus(id) != 0) {
XP2P.stopService(id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ class VideoWithoutPropertyActivity : VideoBaseActivity(), EventView, TextureView
}

XP2P.setCallback(this)
XP2P.startService("${App.data.accessInfo!!.productId}/${presenter.getDeviceName()}",
App.data.accessInfo!!.productId, presenter.getDeviceName(), 5
XP2P.startService(this@VideoWithoutPropertyActivity, "${App.data.accessInfo!!.productId}/${presenter.getDeviceName()}",
App.data.accessInfo!!.productId, presenter.getDeviceName()
)

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

0 comments on commit 91a5374

Please sign in to comment.