產品討論
瀏覽 : 2795
分享

[討論] HTC U12+ 搭配DJI Osmo Mobile 2 延時視頻問題

一般用戶

等級1

路過旅人

文章分類:HTC U12+

振心诚意2018-12-23 02:28

我最近購買了DJI Osmo Mobile 2 (OM2)穩定器。當我在研究如何使用OM2時,發現我的U12+在使用DJI GO app 錄製延時視頻很大機率時會導致DJI GO app 不能保存視頻。經過一連串的測試發現HTC 10 和 HTC U11 都沒這個問題。唯獨U12+例外。我嘗試了恢復原廠設置還是一樣,所以我排除了是第三方app 所導致的。我透過了logcat 取出了手機的日記。相比10 和U11的日記,發現U12+ 在錄製延時視頻時出現不尋常的活動。

以下是三部手機的固件版本:
HTC 10 Android 8.0 (3.16.708.3)
HTC U11 Android 8.0 (2.42.400.3)
HTC U12+ Android 8.0 (1.30.400.2)

以下是我過濾出來的日記:
HTC 10

Line 15115: 12-23 00:52:16.037 1827 15554 I CameraSource: Using encoder format: 0x22
Line 15116: 12-23 00:52:16.037 1827 15554 I CameraSource: Using encoder data space: 0x10c60000
Line 16730: 12-23 00:52:17.210 1827 15555 W CameraSource: Dropping frame with backward timestamp 4010988553 (last 4010988553)
Line 16828: 12-23 00:52:17.243 1827 15555 W CameraSource: Dropping frame with backward timestamp 4010988553 (last 4010988553)
Line 21303: 12-23 00:52:20.771 1827 15546 D CameraSource: reset: E
Line 22176: 12-23 00:52:21.167 1827 15546 D CameraSource: reset: X
Line 22391: 12-23 00:52:21.210 1827 15554 D CameraSource: reset: E
Line 22392: 12-23 00:52:21.210 1827 15554 D CameraSource: reset: X

HTC U11
Line 32759: 12-23 00:39:04.120 2599 27447 I CameraSource: Using encoder format: 0x22
Line 32760: 12-23 00:39:04.120 2599 27447 I CameraSource: Using encoder data space: 0x10c60000
Line 36906: 12-23 00:39:05.199 2599 27451 W CameraSource: Dropping frame with backward timestamp 1985828708799 (last 1985828708799)
Line 46607: 12-23 00:39:07.721 2599 27418 D CameraSource: reset: E
Line 48898: 12-23 00:39:08.141 2599 27418 D CameraSource: reset: X
Line 49087: 12-23 00:39:08.223 2599 27447 D CameraSource: reset: E
Line 49088: 12-23 00:39:08.223 2599 27447 D CameraSource: reset: X

HTC U12+
Line 963: 12-22 23:54:43.276 2650 27537 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 964: 12-22 23:54:43.276 2650 8706 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 965: 12-22 23:54:43.277 2650 16954 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 1465: 12-22 23:54:43.887 2650 23200 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 1898: 12-22 23:54:44.496 2650 21156 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 2942: 12-22 23:54:45.785 2650 18875 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 2943: 12-22 23:54:45.787 2650 12020 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 5751: 12-22 23:54:49.277 2650 27537 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 5752: 12-22 23:54:49.277 2650 8706 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 5753: 12-22 23:54:49.280 2650 16954 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 5940: 12-22 23:54:49.496 2650 21156 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 6291: 12-22 23:54:49.887 2650 23200 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 7876: 12-22 23:54:51.786 2650 18875 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 7877: 12-22 23:54:51.787 2650 12020 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 9996: 12-22 23:54:54.496 2650 21156 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 10697: 12-22 23:54:55.278 2650 8706 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 10698: 12-22 23:54:55.278 2650 27537 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 10699: 12-22 23:54:55.281 2650 16954 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 11238: 12-22 23:54:55.888 2650 23200 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 12738: 12-22 23:54:57.457 2650 8276 I CameraSource: Using encoder format: 0x22
Line 12739: 12-22 23:54:57.457 2650 8276 I CameraSource: Using encoder data space: 0x10c60000
Line 13207: 12-22 23:54:57.786 2650 18875 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 13229: 12-22 23:54:57.787 2650 12020 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 14046: 12-22 23:54:58.386 2650 8277 W CameraSource: Dropping frame with backward timestamp 84748488775 (last 84748488775)
Line 14048: 12-22 23:54:58.413 2650 8277 W CameraSource: Dropping frame with backward timestamp 84748488775 (last 84748488775)
Line 14893: 12-22 23:54:59.497 2650 21156 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 16289: 12-22 23:55:01.279 2650 27537 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 16290: 12-22 23:55:01.279 2650 8706 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 16291: 12-22 23:55:01.279 2650 27537 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 16292: 12-22 23:55:01.281 2650 16954 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 16779: 12-22 23:55:01.888 2650 23200 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 17513: 12-22 23:55:02.755 2650 8212 D CameraSource: reset: E
Line 18319: 12-22 23:55:03.786 2650 18875 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 18320: 12-22 23:55:03.788 2650 12020 W CameraSource: Timed out waiting for outstanding frames being encoded: 1
Line 18825: 12-22 23:55:04.497 2650 21156 W CameraSource: Timed out waiting for outstanding frames being encoded: 1


我懷疑是多次的Time out 導致DJI GO app 不能錄製延時視頻。

分析:
10 和 U11 在停止錄製延時視頻時分別出現兩次 reset: E 接著 reset: X
U12+ 只出現一次 reset: E,沒出現 reset: X

根據 Android的 CameraSource 源碼,
status_t CameraSource::reset() {
ALOGD("reset: E");
{
Mutex::Autolock autoLock(mLock);
mStarted = false;
mEos = false;
mStopSystemTimeUs = -1;
mFrameAvailableCondition.signal();
int64_t token;
bool isTokenValid = false;
if (mCamera != 0) {
token = IPCThreadState::self()->clearCallingIdentity();
isTokenValid = true;
}
releaseQueuedFrames();
while (!mFramesBeingEncoded.empty()) {
if (NO_ERROR !=
mFrameCompleteCondition.waitRelative(mLock,
mTimeBetweenFrameCaptureUs * 1000LL + CAMERA_SOURCE_TIMEOUT_NS)) {
ALOGW("Timed out waiting for outstanding frames being encoded: %zu",
mFramesBeingEncoded.size());

}
}
stopCameraRecording();
if (isTokenValid) {
IPCThreadState::self()->restoreCallingIdentity(token);
}
if (mCollectStats) {
ALOGI("Frames received/encoded/dropped: %d/%d/%d in %" PRId64 " us",
mNumFramesReceived, mNumFramesEncoded, mNumFramesDropped,
mLastFrameTimestampUs - mFirstFrameTimeUs);
}
if (mNumGlitches > 0) {
ALOGW("%d long delays between neighboring video frames", mNumGlitches);
}
CHECK_EQ(mNumFramesReceived, mNumFramesEncoded + mNumFramesDropped);
}
if (mBufferQueueListener != nullptr) {
mBufferQueueListener->requestExit();
mBufferQueueListener->join();
mBufferQueueListener.clear();
}
mVideoBufferConsumer.clear();
mVideoBufferProducer.clear();
releaseCamera();
ALOGD("reset: X");
return OK;
}

在執行 reset 這個 function 時會先寫下日記 "reset: E" ,然後再執行其他工作。當要完成reset function 裏的所有工作后,會寫下日記"reset: X",然後退出reset function。
U12+ 的日記裏沒有出現"reset: X" 那麽代表沒有退出reset function,而且一直在日記裏寫下 "Timed out waiting for outstanding frames being encoded: 1"。
一直重複寫下"Time out ..." 的原因是 mFramesBeingEncoded 這份列表裏面還存在著"物體" 導致無限While 循環。至於什麽原因導致 mFramesBeingEncoded 列表沒有被清空我就不清楚了。

我也附上了從三部手機裏取出的logcat,希望HTC 工程師可以幫我解決這個問題。
https://drive.google.com/file/d/1gBv9NQ-CxuZy4Ey5MevXBYcgIjgm-yW3/view?usp=sharing


本文章最後由( 振心诚意 )於 2018-12-23 02:41 編輯

檢舉 回應

一般用戶

等級1

路過旅人

aaronli2019-10-29 16:15

請問你的U12+有更新到9.0試看看嗎?
因為我最近想買mobile 3,想知道剛u12+的相容是否有問題?

檢舉 回應

分享