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 {
...
@@ -357,6 +357,7 @@ public class HttpConnector {
try
{
try
{
//API2.0
//API2.0
if
(
mIsOldApi
)
{
if
(
mIsOldApi
)
{
//画像ファイルの場合、「recordTime」がないのでJSONException発生
entry
.
getInt
(
"recordTime"
);
entry
.
getInt
(
"recordTime"
);
//動画ファイルは保存しない。
//動画ファイルは保存しない。
continue
;
continue
;
...
...
ABVJE_UI_Android/src/com/theta/view/MJpegView.java
View file @
f9bc2f17
...
@@ -12,16 +12,28 @@ import android.view.SurfaceView;
...
@@ -12,16 +12,28 @@ import android.view.SurfaceView;
import
java.io.IOException
;
import
java.io.IOException
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
/**
/**
* Motion JPEG view
* Motion JPEG view
*/
*/
public
class
MJpegView
extends
SurfaceView
implements
SurfaceHolder
.
Callback
{
public
class
MJpegView
extends
SurfaceView
implements
SurfaceHolder
.
Callback
{
private
static
final
String
TAG
=
"MJpegView"
;
private
MJpegViewThread
mMJpegViewThread
=
null
;
private
MJpegViewThread
mMJpegViewThread
=
null
;
private
MJpegInputStream
mMJpegInputStream
=
null
;
private
MJpegInputStream
mMJpegInputStream
=
null
;
private
boolean
existSurface
=
false
;
private
boolean
existSurface
=
false
;
private
int
mDisplayWidth
;
private
int
mDisplayWidth
;
private
int
mDisplayHeight
;
private
int
mDisplayHeight
;
private
MJpegView
.
LiveCameraListener
mListener
;
public
interface
LiveCameraListener
{
void
liveCameraPlayFail
();
}
public
void
setLiveCameraListenerListener
(
MJpegView
.
LiveCameraListener
listener
)
{
this
.
mListener
=
listener
;
}
/**
/**
* Constructor
* Constructor
* @param context
* @param context
...
@@ -185,7 +197,6 @@ public class MJpegView extends SurfaceView implements SurfaceHolder.Callback {
...
@@ -185,7 +197,6 @@ public class MJpegView extends SurfaceView implements SurfaceHolder.Callback {
Bitmap
bitmap
;
Bitmap
bitmap
;
Rect
bitmapRect
;
Rect
bitmapRect
;
Canvas
bitmapCanvas
=
null
;
Canvas
bitmapCanvas
=
null
;
while
(
keepRunning
)
{
while
(
keepRunning
)
{
if
(
existSurface
)
{
if
(
existSurface
)
{
try
{
try
{
...
@@ -201,7 +212,9 @@ public class MJpegView extends SurfaceView implements SurfaceHolder.Callback {
...
@@ -201,7 +212,9 @@ public class MJpegView extends SurfaceView implements SurfaceHolder.Callback {
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
getStackTrace
();
e
.
getStackTrace
();
Logger
.
e
(
TAG
,
"MJpegView IOException = "
+
e
.
toString
());
keepRunning
=
false
;
keepRunning
=
false
;
mListener
.
liveCameraPlayFail
();
}
}
}
}
}
finally
{
}
finally
{
...
@@ -228,6 +241,7 @@ public class MJpegView extends SurfaceView implements SurfaceHolder.Callback {
...
@@ -228,6 +241,7 @@ public class MJpegView extends SurfaceView implements SurfaceHolder.Callback {
mMJpegInputStream
.
close
();
mMJpegInputStream
.
close
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
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 {
...
@@ -38,7 +38,9 @@ public class ThetaCameraActivity extends ThetaActivity {
private
static
final
String
TAG
=
"ThetaCameraActivity"
;
private
static
final
String
TAG
=
"ThetaCameraActivity"
;
//画面表示後、ライブビューア取得を0.5秒後に取得
//画面表示後、ライブビューア取得を0.5秒後に取得
private
static
final
int
LIVE_VIEW_START_DELAY
=
500
;
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
EV_TEXT_VIEW_TEXT_SIZE_PHONE
=
16
;
private
static
final
int
LIVE_VIDEO_FAIL_MAX_COUNT
=
3
;
private
MJpegView
mLiveView
;
private
MJpegView
mLiveView
;
private
ShowLiveViewTask
mLivePreviewTask
;
private
ShowLiveViewTask
mLivePreviewTask
;
private
Button
mShootBtn
;
private
Button
mShootBtn
;
...
@@ -46,6 +48,8 @@ public class ThetaCameraActivity extends ThetaActivity {
...
@@ -46,6 +48,8 @@ public class ThetaCameraActivity extends ThetaActivity {
private
TextView
mExposureTextView
;
private
TextView
mExposureTextView
;
private
SeekBar
mExposureSeekBar
;
private
SeekBar
mExposureSeekBar
;
private
int
mCurrentSeekBarProgress
;
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"
));
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
@Override
...
@@ -78,6 +82,7 @@ public class ThetaCameraActivity extends ThetaActivity {
...
@@ -78,6 +82,7 @@ public class ThetaCameraActivity extends ThetaActivity {
showProgressPopup
();
showProgressPopup
();
new
ShootTask
(
ThetaCameraActivity
.
this
).
execute
();
new
ShootTask
(
ThetaCameraActivity
.
this
).
execute
();
mLiveView
.
setSource
(
null
);
mLiveView
.
setSource
(
null
);
mLiveViewFailCount
=
0
;
}
}
});
});
...
@@ -90,22 +95,54 @@ public class ThetaCameraActivity extends ThetaActivity {
...
@@ -90,22 +95,54 @@ public class ThetaCameraActivity extends ThetaActivity {
Intent
intent
=
new
Intent
();
Intent
intent
=
new
Intent
();
intent
.
setClassName
(
getPackageName
(),
ThetaImageListActivity
.
class
.
getName
());
intent
.
setClassName
(
getPackageName
(),
ThetaImageListActivity
.
class
.
getName
());
startActivity
(
intent
);
startActivity
(
intent
);
mLiveViewFailCount
=
0
;
}
}
});
});
//露出シークバー
//露出シークバー
settingSeekbar
();
settingSeekbar
();
showProgressPopup
();
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
()
{
handler
.
postDelayed
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
if
(
isFailRetry
)
{
showProgressPopup
();
}
if
(
mLivePreviewTask
!=
null
)
{
mLivePreviewTask
.
cancel
(
true
);
}
mLivePreviewTask
=
new
ShowLiveViewTask
(
ThetaCameraActivity
.
this
);
mLivePreviewTask
=
new
ShowLiveViewTask
(
ThetaCameraActivity
.
this
);
mLivePreviewTask
.
execute
();
mLivePreviewTask
.
execute
();
}
}
},
LIVE_VIEW_START_DELAY
);
},
delayTime
);
}
}
//端末の戻るボタン禁止
//端末の戻るボタン禁止
@Override
@Override
public
boolean
dispatchKeyEvent
(
KeyEvent
event
)
{
public
boolean
dispatchKeyEvent
(
KeyEvent
event
)
{
...
@@ -121,19 +158,18 @@ public class ThetaCameraActivity extends ThetaActivity {
...
@@ -121,19 +158,18 @@ public class ThetaCameraActivity extends ThetaActivity {
@Override
@Override
protected
void
onPause
()
{
protected
void
onPause
()
{
super
.
onPause
();
super
.
onPause
();
mLiveView
.
s
topPlay
(
);
mLiveView
.
s
etSource
(
null
);
}
}
@Override
@Override
protected
void
onResume
()
{
protected
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
mLiveView
.
play
();
Logger
.
d
(
TAG
,
"super.onResume()"
);
if
(
mInitOnResumeFlg
)
{
//初回呼ばれた時は実行しない。(初期表示時)
if
(
mLivePreviewTask
!=
null
)
{
showProgressPopup
();
mLivePreviewTask
.
cancel
(
true
);
startLiveCameraTask
(
false
);
mLivePreviewTask
=
new
ShowLiveViewTask
(
this
);
mLivePreviewTask
.
execute
();
}
}
mInitOnResumeFlg
=
true
;
}
}
@Override
@Override
protected
void
onDestroy
()
{
protected
void
onDestroy
()
{
...
@@ -189,8 +225,6 @@ public class ThetaCameraActivity extends ThetaActivity {
...
@@ -189,8 +225,6 @@ public class ThetaCameraActivity extends ThetaActivity {
public
void
onStartTrackingTouch
(
SeekBar
seekBar
)
{}
public
void
onStartTrackingTouch
(
SeekBar
seekBar
)
{}
});
});
}
}
/**
/**
...
@@ -225,7 +259,7 @@ public class ThetaCameraActivity extends ThetaActivity {
...
@@ -225,7 +259,7 @@ public class ThetaCameraActivity extends ThetaActivity {
mLiveView
.
setSource
(
mJpegInputStream
);
mLiveView
.
setSource
(
mJpegInputStream
);
new
GetOptionExposureTask
(
ThetaCameraActivity
.
this
).
execute
();
new
GetOptionExposureTask
(
ThetaCameraActivity
.
this
).
execute
();
}
else
{
}
else
{
Logger
.
e
(
"failed to start live view"
);
Logger
.
e
(
TAG
,
"failed to start live view"
);
thetaConnectError
(
R
.
string
.
msg_theta_live_image_fail
);
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;
...
@@ -25,7 +25,7 @@ import jp.agentec.abook.abv.ui.viewer.activity.theta.ThetaCameraActivity;
*/
*/
public
class
ShowLiveViewTask
extends
AsyncTask
<
Void
,
String
,
MJpegInputStream
>
{
public
class
ShowLiveViewTask
extends
AsyncTask
<
Void
,
String
,
MJpegInputStream
>
{
private
static
final
String
TAG
=
"ShowLiveViewTask"
;
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
;
private
final
WeakReference
<
ThetaCameraActivity
>
refActivity
;
public
ShowLiveViewTask
(
ThetaCameraActivity
refActivity
)
{
public
ShowLiveViewTask
(
ThetaCameraActivity
refActivity
)
{
...
@@ -43,8 +43,20 @@ public class ShowLiveViewTask extends AsyncTask<Void, String, MJpegInputStream>
...
@@ -43,8 +43,20 @@ public class ShowLiveViewTask extends AsyncTask<Void, String, MJpegInputStream>
HttpConnector
camera
=
new
HttpConnector
(
ABookValues
.
THETA_IP_ADDRESS
,
isOldApi
);
HttpConnector
camera
=
new
HttpConnector
(
ABookValues
.
THETA_IP_ADDRESS
,
isOldApi
);
InputStream
is
=
camera
.
getLivePreview
();
InputStream
is
=
camera
.
getLivePreview
();
mjis
=
new
MJpegInputStream
(
is
);
mjis
=
new
MJpegInputStream
(
is
);
//正常にライブ再生されるか確認
mjis
.
readMJpegFrame
();
retryCount
=
MAX_RETRY_COUNT
;
retryCount
=
MAX_RETRY_COUNT
;
}
catch
(
IOException
e
)
{
}
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
{
try
{
Thread
.
sleep
(
FAIL_RETRAY_DELAY_MILLIS
);
Thread
.
sleep
(
FAIL_RETRAY_DELAY_MILLIS
);
}
catch
(
InterruptedException
e1
)
{
}
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