Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abook_check
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_android
abook_check
Commits
f9bc2f17
Commit
f9bc2f17
authored
Jul 29, 2020
by
Kim Jinsung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
THETA SC2端末で、ライブカメラ映像が正常に表示されない問題対応。
再現率は100%ではないが、初回ライブ映像表示時に発生率が高い
parent
d0820eb3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
15 deletions
+76
-15
ABVJE_UI_Android/src/com/theta/network/HttpConnector.java
+1
-0
ABVJE_UI_Android/src/com/theta/view/MJpegView.java
+15
-1
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/theta/ThetaCameraActivity.java
+47
-13
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/theta/task/ShowLiveViewTask.java
+13
-1
No files found.
ABVJE_UI_Android/src/com/theta/network/HttpConnector.java
View file @
f9bc2f17
...
...
@@ -357,6 +357,7 @@ public class HttpConnector {
try
{
//API2.0
if
(
mIsOldApi
)
{
//画像ファイルの場合、「recordTime」がないのでJSONException発生
entry
.
getInt
(
"recordTime"
);
//動画ファイルは保存しない。
continue
;
...
...
ABVJE_UI_Android/src/com/theta/view/MJpegView.java
View file @
f9bc2f17
...
...
@@ -12,16 +12,28 @@ import android.view.SurfaceView;
import
java.io.IOException
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
/**
* Motion JPEG view
*/
public
class
MJpegView
extends
SurfaceView
implements
SurfaceHolder
.
Callback
{
private
static
final
String
TAG
=
"MJpegView"
;
private
MJpegViewThread
mMJpegViewThread
=
null
;
private
MJpegInputStream
mMJpegInputStream
=
null
;
private
boolean
existSurface
=
false
;
private
int
mDisplayWidth
;
private
int
mDisplayHeight
;
private
MJpegView
.
LiveCameraListener
mListener
;
public
interface
LiveCameraListener
{
void
liveCameraPlayFail
();
}
public
void
setLiveCameraListenerListener
(
MJpegView
.
LiveCameraListener
listener
)
{
this
.
mListener
=
listener
;
}
/**
* Constructor
* @param context
...
...
@@ -185,7 +197,6 @@ public class MJpegView extends SurfaceView implements SurfaceHolder.Callback {
Bitmap
bitmap
;
Rect
bitmapRect
;
Canvas
bitmapCanvas
=
null
;
while
(
keepRunning
)
{
if
(
existSurface
)
{
try
{
...
...
@@ -201,7 +212,9 @@ public class MJpegView extends SurfaceView implements SurfaceHolder.Callback {
}
}
catch
(
IOException
e
)
{
e
.
getStackTrace
();
Logger
.
e
(
TAG
,
"MJpegView IOException = "
+
e
.
toString
());
keepRunning
=
false
;
mListener
.
liveCameraPlayFail
();
}
}
}
finally
{
...
...
@@ -228,6 +241,7 @@ public class MJpegView extends SurfaceView implements SurfaceHolder.Callback {
mMJpegInputStream
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
Logger
.
e
(
TAG
,
"mMJpegInputStream IOException = "
+
e
.
toString
());
}
}
}
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/theta/ThetaCameraActivity.java
View file @
f9bc2f17
...
...
@@ -38,7 +38,9 @@ public class ThetaCameraActivity extends ThetaActivity {
private
static
final
String
TAG
=
"ThetaCameraActivity"
;
//画面表示後、ライブビューア取得を0.5秒後に取得
private
static
final
int
LIVE_VIEW_START_DELAY
=
500
;
private
static
final
int
LIVE_VIEW_FAIL_START_DELAY
=
1000
;
private
static
final
int
EV_TEXT_VIEW_TEXT_SIZE_PHONE
=
16
;
private
static
final
int
LIVE_VIDEO_FAIL_MAX_COUNT
=
3
;
private
MJpegView
mLiveView
;
private
ShowLiveViewTask
mLivePreviewTask
;
private
Button
mShootBtn
;
...
...
@@ -46,6 +48,8 @@ public class ThetaCameraActivity extends ThetaActivity {
private
TextView
mExposureTextView
;
private
SeekBar
mExposureSeekBar
;
private
int
mCurrentSeekBarProgress
;
private
int
mLiveViewFailCount
;
private
boolean
mInitOnResumeFlg
=
false
;
private
static
final
List
<
String
>
mExposureValues
=
new
ArrayList
<>(
Arrays
.
asList
(
"-2.0"
,
"-1.7"
,
"-1.3"
,
"-1.0"
,
"-0.7"
,
"-0.3"
,
"0.0"
,
"0.3"
,
"0.7"
,
"1.0"
,
"1.3"
,
"1.7"
,
"2.0"
));
@Override
...
...
@@ -78,6 +82,7 @@ public class ThetaCameraActivity extends ThetaActivity {
showProgressPopup
();
new
ShootTask
(
ThetaCameraActivity
.
this
).
execute
();
mLiveView
.
setSource
(
null
);
mLiveViewFailCount
=
0
;
}
});
...
...
@@ -90,22 +95,54 @@ public class ThetaCameraActivity extends ThetaActivity {
Intent
intent
=
new
Intent
();
intent
.
setClassName
(
getPackageName
(),
ThetaImageListActivity
.
class
.
getName
());
startActivity
(
intent
);
mLiveViewFailCount
=
0
;
}
});
//露出シークバー
settingSeekbar
();
showProgressPopup
();
startLiveCameraTask
(
false
);
mLiveViewFailCount
=
0
;
mLiveView
.
setLiveCameraListenerListener
(
new
MJpegView
.
LiveCameraListener
()
{
@Override
public
void
liveCameraPlayFail
()
{
mLiveViewFailCount
++;
Logger
.
e
(
TAG
,
"mLiveViewFailCount = "
+
mLiveViewFailCount
);
if
(
mLiveViewFailCount
==
LIVE_VIDEO_FAIL_MAX_COUNT
)
{
handler
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
mLiveView
.
setSource
(
null
);
thetaConnectError
(
R
.
string
.
msg_theta_live_image_fail
);
}
});
return
;
}
startLiveCameraTask
(
true
);
}
});
}
private
void
startLiveCameraTask
(
final
boolean
isFailRetry
)
{
int
delayTime
=
LIVE_VIEW_START_DELAY
;
if
(
isFailRetry
)
{
//失敗時にはリトライを1秒後に行うように設定
delayTime
=
LIVE_VIEW_FAIL_START_DELAY
;
}
handler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
isFailRetry
)
{
showProgressPopup
();
}
if
(
mLivePreviewTask
!=
null
)
{
mLivePreviewTask
.
cancel
(
true
);
}
mLivePreviewTask
=
new
ShowLiveViewTask
(
ThetaCameraActivity
.
this
);
mLivePreviewTask
.
execute
();
}
},
LIVE_VIEW_START_DELAY
);
},
delayTime
);
}
//端末の戻るボタン禁止
@Override
public
boolean
dispatchKeyEvent
(
KeyEvent
event
)
{
...
...
@@ -121,19 +158,18 @@ public class ThetaCameraActivity extends ThetaActivity {
@Override
protected
void
onPause
()
{
super
.
onPause
();
mLiveView
.
s
topPlay
(
);
mLiveView
.
s
etSource
(
null
);
}
@Override
protected
void
onResume
()
{
super
.
onResume
();
mLiveView
.
play
();
if
(
mLivePreviewTask
!=
null
)
{
mLivePreviewTask
.
cancel
(
true
);
mLivePreviewTask
=
new
ShowLiveViewTask
(
this
);
mLivePreviewTask
.
execute
();
Logger
.
d
(
TAG
,
"super.onResume()"
);
if
(
mInitOnResumeFlg
)
{
//初回呼ばれた時は実行しない。(初期表示時)
showProgressPopup
();
startLiveCameraTask
(
false
);
}
mInitOnResumeFlg
=
true
;
}
@Override
protected
void
onDestroy
()
{
...
...
@@ -189,8 +225,6 @@ public class ThetaCameraActivity extends ThetaActivity {
public
void
onStartTrackingTouch
(
SeekBar
seekBar
)
{}
});
}
/**
...
...
@@ -225,7 +259,7 @@ public class ThetaCameraActivity extends ThetaActivity {
mLiveView
.
setSource
(
mJpegInputStream
);
new
GetOptionExposureTask
(
ThetaCameraActivity
.
this
).
execute
();
}
else
{
Logger
.
e
(
"failed to start live view"
);
Logger
.
e
(
TAG
,
"failed to start live view"
);
thetaConnectError
(
R
.
string
.
msg_theta_live_image_fail
);
}
}
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/viewer/activity/theta/task/ShowLiveViewTask.java
View file @
f9bc2f17
...
...
@@ -25,7 +25,7 @@ import jp.agentec.abook.abv.ui.viewer.activity.theta.ThetaCameraActivity;
*/
public
class
ShowLiveViewTask
extends
AsyncTask
<
Void
,
String
,
MJpegInputStream
>
{
private
static
final
String
TAG
=
"ShowLiveViewTask"
;
private
static
final
int
FAIL_RETRAY_DELAY_MILLIS
=
5
00
;
private
static
final
int
FAIL_RETRAY_DELAY_MILLIS
=
10
00
;
private
final
WeakReference
<
ThetaCameraActivity
>
refActivity
;
public
ShowLiveViewTask
(
ThetaCameraActivity
refActivity
)
{
...
...
@@ -43,8 +43,20 @@ public class ShowLiveViewTask extends AsyncTask<Void, String, MJpegInputStream>
HttpConnector
camera
=
new
HttpConnector
(
ABookValues
.
THETA_IP_ADDRESS
,
isOldApi
);
InputStream
is
=
camera
.
getLivePreview
();
mjis
=
new
MJpegInputStream
(
is
);
//正常にライブ再生されるか確認
mjis
.
readMJpegFrame
();
retryCount
=
MAX_RETRY_COUNT
;
}
catch
(
IOException
e
)
{
Logger
.
e
(
TAG
,
"doInBackground fail e = "
+
e
.
toString
());
if
(
mjis
!=
null
)
{
try
{
mjis
.
close
();
}
catch
(
IOException
ex
)
{
Logger
.
e
(
TAG
,
"doInBackground fail ex = "
+
ex
.
toString
());
}
}
try
{
Thread
.
sleep
(
FAIL_RETRAY_DELAY_MILLIS
);
}
catch
(
InterruptedException
e1
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment