Could be that your code fixes it.
I have updated to 1.7.0 - it took couple of recording and it happens again.
here are some extra logs - in the 2 "BVR1.7.0" you can see exactly what I mean.
"what do I mean - the muxer do not closed correctly."
from my personal experience - when the muxer, the audio codec and the video codec which runs on different threads are not in sync. this logs appears.
sometimes also cause of wrong timestamps.
on closing of the video - my app is waiting couple of seconds which means that one thread is still waiting on the join thread.
I see a lot of this messages :
"plementalItem in surface: home [CONTEXT ratelimit_period="10 SECONDS" ]
13:09:31.520 I #remoteViewsTwiddler: feature disabled.
13:09:31.524 I #postPredictionTargets: Sending updates to UISurface lockscreen with targets# 1 (types=[1])
13:09:31.525 I #postPredictionTargets: Sending updates to UISurface ambientcue with targets# 0 (types=[])
13:09:31.525 I Receiving SmartSpace targets # 0
13:09:31.528 I setFormattedContentDescription: text=8°C, iconDescription=Mostly cloudy day, contentDescription=Mostly cloudy day 8°C
13:09:31.528 I #postPredictionTargets: Sending updates to UISurface home with targets# 1 (types=[1])
13:09:31.528 I setFormattedContentDescription: text=8°C, iconDescription=Mostly cloudy day, contentDescription=Mostly cloudy day 8°C
13:09:31.528 I Weather data parsed MOSTLY_CLOUDY_DAY ("Mostly cloudy day") 8°C from Bundle[{description=Mostly cloudy day, feedback_intent=null, explanation_intent=Supplier{VAL_PARCELABLE@160+1920}, is_gaia_linked_data=true, use_celsius=true, state=7, temperature=8}]
13:09:31.528 W Drop audio data due to full of queue.
13:09:31.531 I #postPredictionTargets: Sending updates to UISurface lockscreen with targets# 1 (types=[1])
13:09:31.532 I #postPredictionTargets: Sending updates to UISurface ambientcue with targets# 0 (types=[])
13:09:31.533 I Receiving SmartSpace targets # 0
13:09:31.534 I #postPredictionTargets: Sending updates to UISurface home with targets# 1 (types=[1])
13:09:31.537 I setFormattedContentDescription: text=8°C, iconDescription=Mostly cloudy day, contentDescription=Mostly cloudy day 8°C
13:09:31.537 I setFormattedContentDescription: text=8°C, iconDescription=Mostly cloudy day, contentDescription=Mostly cloudy day 8°C
13:09:31.537 I Weather data parsed MOSTLY_CLOUDY_DAY ("Mostly cloudy day") 8°C from Bundle[{description=Mostly cloudy day, feedback_intent=null, explanation_intent=Supplier{VAL_PARCELABLE@160+1920}, is_gaia_linked_data=true, use_celsius=true, state=7, temperature=8}]
13:09:31.549 W Drop audio data due to full of queue.
13:09:31.568 W Drop audio data due to full of queue.
13:09:31.581 D [77320]< UPDATE_DEVICE_STATE
13:09:31.586 I GetImpedances: speaker [0] impedance: 100 Ohms
13:09:31.586 I GetImpedances: speaker [1] impedance: 100 Ohms
13:09:31.586 I GetTemperatures: DSP1 Protection cd BDLOG_MAX_TEMP Max temp: 0x1a4e24 ==> 105.221 C
13:09:31.587 I GetTemperatures: R DSP1 Protection cd BDLOG_MAX_TEMP Max temp: 0x17dfa6 ==> 95.4945 C
13:09:31.587 I GetExcursions: DSP1 Protection cd BDLOG_MAX_EXC Max exc: 0x39999 ==> 0.449999 mm
13:09:31.587 I GetExcursions: R DSP1 Protection cd BDLOG_MAX_EXC Max exc: 0x3ffff ==> 0.499998 mm
13:09:31.587 I GetHeartBeats: DSP1 Protection 400a4 HALO_HEARTBEAT dsp heartbeat = 0x127d4
13:09:31.587 I GetHeartBeats: R DSP1 Protection 400a4 HALO_HEARTBEAT dsp heartbeat = 0x127d5
13:09:31.589 W Drop audio data due to full of queue.
13:09:31.609 W Drop audio data due to full of queue.
13:09:31.628 W Drop audio data due to full of queue.
13:09:31.648 W Drop audio data due to full of queue.
13:09:31.668 W Drop audio data due to full of queue.
13:09:31.689 W Drop audio data due to full of queue.
13:09:31.708 W Drop audio data due to full of queue.
13:09:31.728 W Drop audio data due to full of queue.
13:09:31.734 D sync unfroze 3789 com.google.android.settings.intelligence for 6
13:09:31.749 D sync unfroze 12443 com.facebook.katana for 6
13:09:31.751 D sync unfroze 12837 com.facebook.katana:sandboxed_process0:com.facebook.browser.helium.content.SandboxedProcessService0:0 for 6
13:09:31.753 D sync unfroze 12829 com.facebook.katana:zygote_warmer:com.facebook.browser.helium.preload.AppZygoteWarmerService for 6
13:09:31.785 W Drop audio data due to full of queue.
13:09:31.786 W Drop audio data due to full of queue.
13:09:31.798 W Drop audio data due to full of queue.
13:09:31.806 D Video data reaches duration limit 20000655 > 20000000
13:09:31.807 D Video data reaches duration limit 20067323 > 20000000
13:09:31.808 D Video data reaches duration limit 20133993 > 20000000
13:09:31.809 D Video data reaches duration limit 20200661 > 20000000
13:09:31.809 D Video data reaches duration limit 20267329 > 20000000
13:09:31.810 D Video data reaches duration limit 20333999 > 20000000
13:09:31.811 D Video data reaches duration limit 20400667 > 20000000
13:09:31.811 D Video data reaches duration limit 20467205 > 20000000
13:09:31.812 D Video data reaches duration limit 20534005 > 20000000
13:09:31.812 D Video data reaches duration limit 20600675 > 20000000
13:09:31.813 D Video data reaches duration limit 20667343 > 20000000
13:09:31.814 D Video data reaches duration limit 20734011 > 20000000
13:09:31.814 D Video data reaches duration limit 20800681 > 20000000
13:09:31.815 D Video data reaches duration limit 20867349 > 20000000
13:09:31.816 D Video data reaches duration limit 20934019 > 20000000
13:09:31.816 D Video data reaches duration limit 21000687 > 20000000
13:09:31.817 D Video data reaches duration limit 21067355 > 20000000
13:09:31.817 D Video data reaches duration limit 21134025 > 20000000
13:09:31.818 D Video data reaches duration limit 21200693 > 20000000
13:09:31.819 D Video data reaches duration limit 21267363 > 20000000
13:09:31.819 D Video data reaches duration limit 21334031 > 20000000
13:09:31.820 D Video data reaches duration limit 21400701 > 20000000
13:09:31.821 D Video data reaches duration limit 21467297 > 20000000
13:09:31.821 D Video data reaches duration limit 21534037 > 20000000
13:09:31.821 W Tracking association SourceState{c307414 system/1000 ImpBg #1577681} whose proc state 6 is better than process ProcessState{eb1a2f com.facebook.katana/10319 pkg=com.facebook.katana} proc state 14 (2 skipped)
13:09:31.822 D Video data reaches duration limit 21600707 > 20000000
13:09:31.822 D Video data reaches duration limit 21667375 > 20000000
13:09:31.823 D Video data reaches duration limit 21734045 > 20000000
13:09:31.823 D Video data reaches duration limit 21800713 > 20000000
13:09:31.824 D Video data reaches duration limit 21867383 > 20000000
13:09:31.824 D Video data reaches duration limit 21934051 > 20000000
13:09:31.825 D Video data reaches duration limit 22000719 > 20000000
13:09:31.825 D Video data reaches duration limit 22067389 > 20000000
13:09:31.826 D Video data reaches duration limit 22134057 > 20000000
13:09:31.827 D Video data reaches duration limit 22200727 > 20000000
13:09:31.828 D Video data reaches duration limit 22267395 > 20000000
13:09:31.828 D Video data reaches duration limit 22334065 > 20000000
13:09:31.829 W Drop audio data due to full of queue.
13:09:31.830 D Video data reaches duration limit 22400733 > 20000000
13:09:31.831 D Video data reaches duration limit 22467401 > 20000000
13:09:31.831 D Video data reaches duration limit 22534071 > 20000000
13:09:31.832 D Video data reaches duration limit 22600739 > 20000000
13:09:31.833 D Video data reaches duration limit 22667409 > 20000000
13:09:31.834 D Video data reaches duration limit 22734077 > 20000000
13:09:31.834 D Video data reaches duration limit 22800745 > 20000000
13:09:31.835 D Video data reaches duration limit 22867415 > 20000000
13:09:31.835 D Video data reaches duration limit 22934069 > 20000000
13:09:31.835 D Video data reaches duration limit 23000753 > 20000000
13:09:31.836 D Video data reaches duration limit 23067421 > 20000000"
This is my code after your recommendation - It works for the last 10 minutes which is maybe ok
if (isVideoRecordingAllowed) {
if (videoCapture == null) {
QualitySelector selector = null;
int selectorFromPref = 0;
try {
selectorFromPref = Integer.parseInt(
mSharedPreferences.getString("listCameraXRes", "2")
);
} catch (Exception ex) {
AppendLogError(ex.toString());
}
// =====================================================
// DEVICE ROTATION (SAFE IN SERVICE)
// =====================================================
int deviceRotation = Surface.ROTATION_0;
try {
WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
if (wm != null) {
Display display = wm.getDefaultDisplay();
if (display != null) {
deviceRotation = display.getRotation();
}
}
} catch (Exception ex) {
AppendLogError("Rotation error: " + ex);
}
AppendLogDebug("CameraX TargetRotation = " + deviceRotation);
// =====================================================
// QUALITY SELECTOR LOGIC
// =====================================================
if (selectorFromPref == 0 && isWearOSRemote) {
// Prefer 2160p if available (non-HDR)
if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_2160P) && !cameraxHDR) {
CamcorderProfile p = CamcorderProfile.get(CamcorderProfile.QUALITY_2160P);
int fps = p.videoFrameRate;
if (fps == 60) {
selectedFPSHigh = 60;
selectedFPSLow = 60;
}
AppendLogDebug("2160p: " + p.videoFrameWidth + "x" + p.videoFrameHeight + " @ " + fps + "fps");
selector = QualitySelector.fromOrderedList(
java.util.Arrays.asList(Quality.UHD, Quality.FHD, Quality.HD, Quality.SD),
FallbackStrategy.lowerQualityOrHigherThan(Quality.SD)
);
}
// Else prefer 1080p
else if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_1080P) && !cameraxHDR) {
CamcorderProfile p = CamcorderProfile.get(CamcorderProfile.QUALITY_1080P);
int fps = p.videoFrameRate;
if (fps == 60) {
selectedFPSHigh = 60;
selectedFPSLow = 60;
}
AppendLogDebug("1080p: " + p.videoFrameWidth + "x" + p.videoFrameHeight + " @ " + fps + "fps");
selector = QualitySelector.fromOrderedList(
java.util.Arrays.asList(Quality.FHD, Quality.HD, Quality.SD),
FallbackStrategy.lowerQualityOrHigherThan(Quality.SD)
);
} else {
// Fallback: FHD → HD → SD
selector = QualitySelector.fromOrderedList(
java.util.Arrays.asList(Quality.FHD, Quality.HD, Quality.SD),
FallbackStrategy.lowerQualityOrHigherThan(Quality.SD)
);
}
} else if (shaderCameraX == Constants.CameraX_FilterType.DUAL
|| cameraxDual
|| cameraxWatermnark
|| cameraxHDR) {
// For dual / watermark / HDR: keep resolutions moderate
selector = QualitySelector.fromOrderedList(
java.util.Arrays.asList(Quality.FHD, Quality.HD, Quality.SD, Quality.LOWEST),
FallbackStrategy.lowerQualityOrHigherThan(Quality.SD)
);
} else {
// Default: let CameraX pick the highest possible
selector = QualitySelector.fromOrderedList(
java.util.Arrays.asList(
Quality.HIGHEST,
Quality.UHD,
Quality.FHD,
Quality.HD,
Quality.SD
),
FallbackStrategy.lowerQualityOrHigherThan(Quality.SD)
);
}
// =====================================================
// MANUAL QUALITY OVERRIDE FROM PREF
// =====================================================
switch (selectorFromPref) {
case 1:
// UHD → FHD → HD → SD
selector = QualitySelector.fromOrderedList(
java.util.Arrays.asList(Quality.UHD, Quality.FHD, Quality.HD, Quality.SD),
FallbackStrategy.lowerQualityOrHigherThan(Quality.SD)
);
break;
case 2:
// FHD → HD → SD
selector = QualitySelector.fromOrderedList(
java.util.Arrays.asList(Quality.FHD, Quality.HD, Quality.SD),
FallbackStrategy.lowerQualityOrHigherThan(Quality.SD)
);
break;
case 3:
// HD → SD
selector = QualitySelector.fromOrderedList(
java.util.Arrays.asList(Quality.HD, Quality.SD),
FallbackStrategy.lowerQualityOrHigherThan(Quality.SD)
);
break;
case 4:
// SD only
selector = QualitySelector.from(Quality.SD);
break;
case 5:
// SD → LOWEST
selector = QualitySelector.fromOrderedList(
java.util.Arrays.asList(Quality.SD, Quality.LOWEST),
FallbackStrategy.lowerQualityOrHigherThan(Quality.LOWEST)
);
break;
case 0:
default:
// 0 = "auto" → keep selector as computed above
break;
}
// =====================================================
// RECORDER BUILDER
// =====================================================
//Recorder recorder = new Recorder.Builder()
// .setQualitySelector(selector)
// .build();
Recorder.Builder builder2 = new Recorder.Builder().setQualitySelector(selector);
builder2.setMuxerFactory(new MuxerFactory() {