Merge "Only allow RecordDVR to flush buffer when the DVR is stopped"
This commit is contained in:
@@ -47,6 +47,7 @@ public class DvrRecorder implements AutoCloseable {
|
|||||||
private static int sInstantId = 0;
|
private static int sInstantId = 0;
|
||||||
private int mSegmentId = 0;
|
private int mSegmentId = 0;
|
||||||
private int mOverflow;
|
private int mOverflow;
|
||||||
|
private Boolean mIsStopped = null;
|
||||||
|
|
||||||
private native int nativeAttachFilter(Filter filter);
|
private native int nativeAttachFilter(Filter filter);
|
||||||
private native int nativeDetachFilter(Filter filter);
|
private native int nativeDetachFilter(Filter filter);
|
||||||
@@ -135,7 +136,13 @@ public class DvrRecorder implements AutoCloseable {
|
|||||||
.write(FrameworkStatsLog.TV_TUNER_DVR_STATUS, mUserId,
|
.write(FrameworkStatsLog.TV_TUNER_DVR_STATUS, mUserId,
|
||||||
FrameworkStatsLog.TV_TUNER_DVR_STATUS__TYPE__RECORD,
|
FrameworkStatsLog.TV_TUNER_DVR_STATUS__TYPE__RECORD,
|
||||||
FrameworkStatsLog.TV_TUNER_DVR_STATUS__STATE__STARTED, mSegmentId, 0);
|
FrameworkStatsLog.TV_TUNER_DVR_STATUS__STATE__STARTED, mSegmentId, 0);
|
||||||
return nativeStartDvr();
|
synchronized (mIsStopped) {
|
||||||
|
int result = nativeStartDvr();
|
||||||
|
if (result == Tuner.RESULT_SUCCESS) {
|
||||||
|
mIsStopped = false;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -152,7 +159,13 @@ public class DvrRecorder implements AutoCloseable {
|
|||||||
.write(FrameworkStatsLog.TV_TUNER_DVR_STATUS, mUserId,
|
.write(FrameworkStatsLog.TV_TUNER_DVR_STATUS, mUserId,
|
||||||
FrameworkStatsLog.TV_TUNER_DVR_STATUS__TYPE__RECORD,
|
FrameworkStatsLog.TV_TUNER_DVR_STATUS__TYPE__RECORD,
|
||||||
FrameworkStatsLog.TV_TUNER_DVR_STATUS__STATE__STOPPED, mSegmentId, mOverflow);
|
FrameworkStatsLog.TV_TUNER_DVR_STATUS__STATE__STOPPED, mSegmentId, mOverflow);
|
||||||
return nativeStopDvr();
|
synchronized (mIsStopped) {
|
||||||
|
int result = nativeStopDvr();
|
||||||
|
if (result == Tuner.RESULT_SUCCESS) {
|
||||||
|
mIsStopped = true;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -164,7 +177,13 @@ public class DvrRecorder implements AutoCloseable {
|
|||||||
*/
|
*/
|
||||||
@Result
|
@Result
|
||||||
public int flush() {
|
public int flush() {
|
||||||
return nativeFlushDvr();
|
synchronized (mIsStopped) {
|
||||||
|
if (mIsStopped) {
|
||||||
|
return nativeFlushDvr();
|
||||||
|
}
|
||||||
|
Log.w(TAG, "Cannot flush non-stopped Record DVR.");
|
||||||
|
return Tuner.RESULT_INVALID_STATE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user