[audio_core] More debug info for sampler breaks
Add more detail, for existing consistency DCHECKs within the
Linear and Point samplers.
Test: build, CQ, verified it works as expected upon hitting it
Change-Id: Ibbb823fdaef7e4de444effae7d06a07b409946de
diff --git a/bin/media/audio_core/mixer/linear_sampler.cc b/bin/media/audio_core/mixer/linear_sampler.cc
index 060e99f..852f2a9 100644
--- a/bin/media/audio_core/mixer/linear_sampler.cc
+++ b/bin/media/audio_core/mixer/linear_sampler.cc
@@ -141,12 +141,17 @@
// Otherwise, all these samples are in the future and irrelevant here. Callers
// explicitly avoid calling Mix in this case, so we have detected an error.
// For linear_sampler it implies a requirement that src_off > -FRAC_ONE.
- FXL_DCHECK(src_off + static_cast<int32_t>(pos_filter_width()) >= 0);
+ FXL_DCHECK(src_off + static_cast<int32_t>(pos_filter_width()) >= 0)
+ << std::hex << "min allowed: 0x" << -pos_filter_width() << ", src_off: 0x"
+ << src_off;
// Source offset must also be within neg_filter_width of our last sample.
// Otherwise, all these samples are in the past and irrelevant here. Callers
// explicitly avoid calling Mix in this case, so we have detected an error.
// For linear_sampler this implies that src_off < frac_src_frames.
- FXL_DCHECK(src_off + FRAC_ONE <= frac_src_frames + neg_filter_width());
+ FXL_DCHECK(src_off + FRAC_ONE <= frac_src_frames + neg_filter_width())
+ << std::hex << "max allowed: 0x"
+ << frac_src_frames + neg_filter_width() - FRAC_ONE << ", src_off: 0x"
+ << src_off;
Gain::AScale amplitude_scale;
if constexpr (ScaleType != ScalerType::RAMPING) {
diff --git a/bin/media/audio_core/mixer/point_sampler.cc b/bin/media/audio_core/mixer/point_sampler.cc
index a8bcb6c..b622ea1 100644
--- a/bin/media/audio_core/mixer/point_sampler.cc
+++ b/bin/media/audio_core/mixer/point_sampler.cc
@@ -114,10 +114,12 @@
// Source offset can be negative, but within the bounds of pos_filter_width.
// PointSampler has no memory: input frames only affect present/future output.
// That is: its "positive filter width" is zero.
- FXL_DCHECK(src_off >= 0);
+ FXL_DCHECK(src_off >= 0) << std::hex << "src_off: 0x" << src_off;
+
// Source offset must also be within neg_filter_width of our last sample.
// Neg_filter_width is just shy of FRAC_ONE; src_off can't exceed the buf.
- FXL_DCHECK(src_off < static_cast<int32_t>(frac_src_frames));
+ FXL_DCHECK(src_off < static_cast<int32_t>(frac_src_frames))
+ << std::hex << "src_off: 0x" << src_off;
// If we are not attenuated to the point of being muted, go ahead and perform
// the mix. Otherwise, just update the source and dest offsets.
@@ -153,8 +155,7 @@
}
} else {
if (dest_off < dest_frames) {
- // Calc how many samples we would've produced; update src_off &
- // dest_off.
+ // Calc how much we would've produced; update src_off & dest_off.
uint32_t src_avail =
((frac_src_frames - src_off) + step_size - 1) / step_size;
uint32_t dest_avail = (dest_frames - dest_off);