summaryrefslogtreecommitdiff
path: root/dom/media/GraphDriver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media/GraphDriver.cpp')
-rw-r--r--dom/media/GraphDriver.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp
index 70b59c61f..90680d8c6 100644
--- a/dom/media/GraphDriver.cpp
+++ b/dom/media/GraphDriver.cpp
@@ -593,6 +593,7 @@ AudioCallbackDriver::Init()
cubeb_stream_params output;
cubeb_stream_params input;
+ uint32_t latency_frames;
MOZ_ASSERT(!NS_IsMainThread(),
"This is blocking and should never run on the main thread.");
@@ -608,7 +609,14 @@ AudioCallbackDriver::Init()
output.format = CUBEB_SAMPLE_FLOAT32NE;
}
- uint32_t latency_frames = CubebUtils::GetCubebMSGLatencyInFrames(&output);
+ Maybe<uint32_t> latencyPref = CubebUtils::GetCubebMSGLatencyInFrames();
+ if (latencyPref) {
+ latency_frames = latencyPref.value();
+ } else {
+ if (cubeb_get_min_latency(cubebContext, output, &latency_frames) != CUBEB_OK) {
+ NS_WARNING("Could not get minimal latency from cubeb.");
+ }
+ }
input = output;
input.channels = mInputChannels; // change to support optional stereo capture