Merge remote-tracking branch 'origin/dev2_aiSdk' into dev2_aiSdk

This commit is contained in:
董宏宇
2021-02-23 20:00:30 +08:00
2 changed files with 46 additions and 45 deletions

1
.idea/gradle.xml generated
View File

@@ -91,6 +91,7 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

View File

@@ -170,7 +170,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
// mFromType
// )
getInfo("", "", mLongitude, mLatitude, mType, 1.0f, "", "", 1, mFromType, CarCorderController.mainInfoId)?.let { uploadRoadInfo(it) }
getInfo("", mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 1, mFromType, CarCorderController.mainInfoId)?.let { uploadRoadInfo(it) }
//地图上打点
taskAsync(3_000) {
@@ -213,7 +213,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
// mFromType
// )
getInfo("", "", mLongitude, mLatitude, mType, 1.0f, "", "", 0, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
getInfo("", mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 0, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
}
@@ -259,7 +259,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
// mLatitude, mSpeed)
if (photoPath != null) {
getInfo(photoPath, "", mLongitude, mLatitude, mType, 1.0f, "", "", 0, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
getInfo(photoPath, mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 0, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
}
} else {
@@ -283,7 +283,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
// )
if (photoPath != null) {
getInfo(photoPath, "", mLongitude, mLatitude, mType, 1.0f, "", "", 0, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
getInfo(photoPath, mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 0, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
}
}
}
@@ -303,7 +303,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
// )
if (photoPath != null) {
getInfo(photoPath, "", mLongitude, mLatitude, mType, 1.0f, "", "", 0, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
getInfo(photoPath, mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 0, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
}
}
@@ -343,13 +343,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
entity?.let {
if (it.isCustom) {
// compressVideo(videoPath, thumbnailPath, it)
getInfo(videoPath, "", mLongitude, mLatitude, mType, 1.0f, "", "", 1, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
compressVideo(videoPath, thumbnailPath, it)
} else if (entity.fromType in STRATEGY_UPLOAD_TYPE_ARRAY) {
// 属于策略上报
// compressVideo(videoPath, thumbnailPath, it)
getInfo(videoPath, "", mLongitude, mLatitude, mType, 1.0f, "", "", 1, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
compressVideo(videoPath, thumbnailPath, it)
} else {
Log.d(
@@ -360,16 +358,14 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
Log.d(TAG, "onTakeVideoSuccess 111 abs =" + (abs(minSpeedVideo) / 3.6f))
if (speed >= (abs(minSpeedVideo) / 3.6f)) {
//获取视频以及缩略图成功,开始上报
// compressVideo(videoPath, thumbnailPath, it)
getInfo(videoPath, "", mLongitude, mLatitude, mType, 1.0f, "", "", 1, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
compressVideo(videoPath, thumbnailPath, it)
}
}
if (minSpeedVideo > 0 && maxSpeedVideo > 0) {
Log.d(TAG, "onTakeVideoSuccess minSpeedVideo > 0 -- speed = $speed")
if ((speed >= (minSpeedVideo / 3.6f)) && speed <= (maxSpeedVideo / 3.6f)) {
// compressVideo(videoPath, thumbnailPath, it)
getInfo(videoPath, "", mLongitude, mLatitude, mType, 1.0f, "", "", 1, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
compressVideo(videoPath, thumbnailPath, it)
} else {
}
} else {
@@ -414,7 +410,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
// mFromType
// )
getInfo("", "", mLongitude, mLatitude, mType, 1.0f, "", "", 1, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
getInfo("", mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 1, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
//地图上打点
taskAsync(3_000) {
@@ -429,24 +425,24 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
/**
* 压缩视频并且上传
*/
// private fun compressVideo(videoPath: String, thumbnailPath: String, entity: TakeEntity) {
// Log.d(
// TAG,
// "outputVideoPath = " + outputVideoPath + ">> videoPath=" + videoPath + " isCustom = ${entity.isCustom}"
// )
// val startTime = System.currentTimeMillis()
// Thread(Runnable {
// try {
// VideoProcessor.processor(AbsMogoApplication.getApp().applicationContext)
// .input(videoPath)
// .output(outputVideoPath)
// .removeAudio(true)
// .outWidth(1920)
// .outHeight(1080)
// .bitrate(2000 * 1024)
// .frameRate(25)
// .process()
// Log.d(TAG, "compress cost time =" + (System.currentTimeMillis() - startTime))
private fun compressVideo(videoPath: String, thumbnailPath: String, entity: TakeEntity) {
Log.d(
TAG,
"outputVideoPath = " + outputVideoPath + ">> videoPath=" + videoPath + " isCustom = ${entity.isCustom}"
)
val startTime = System.currentTimeMillis()
Thread(Runnable {
try {
VideoProcessor.processor(AbsMogoApplication.getApp().applicationContext)
.input(videoPath)
.output(outputVideoPath)
.removeAudio(true)
.outWidth(1920)
.outHeight(1080)
.bitrate(2000 * 1024)
.frameRate(25)
.process()
Log.d(TAG, "compress cost time =" + (System.currentTimeMillis() - startTime))
// CosStatusController().uploadFile(
// mutableListOf(outputVideoPath, thumbnailPath),
// entity,
@@ -457,17 +453,19 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
// mLatitude,
// mSpeed
// )
//
// //删除压缩前的视频
// deletePicFile(videoPath)
// } catch (e: Exception) {
// Log.e(TAG, "compressVideo e = $e")
// //删除压缩前的视频
// deletePicFile(videoPath)
// e.printStackTrace()
// }
// }).start()
// }
getInfo(outputVideoPath, mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 1, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
//删除压缩前的视频
deletePicFile(videoPath)
} catch (e: Exception) {
Log.e(TAG, "compressVideo e = $e")
//删除压缩前的视频
deletePicFile(videoPath)
e.printStackTrace()
}
}).start()
}
/**
* 上报路况的视频和图片
@@ -475,7 +473,9 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
fun uploadRoadInfo(info: UploadInfo) {
MogoUploadManager.getInstance(AbsMogoApplication.getApp().applicationContext).uploadInfo(info, object : ITanluUploadCallback {
override fun onSuccess(result: BaseData<UploadResult>) {
if (result != null) {
Log.d(TAG, "result =" + result.result);
}
}
override fun onFailure(code: Int) {
@@ -531,7 +531,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
// mFromType
// )
getInfo("", "", mLongitude, mLatitude, mType, 1.0f, "", "", 1, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
getInfo("", mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 1, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
}