Bug 1270135 - Initialize the frame count properly to avoid passing a random value down the callback. r?kinetik
When draining (probable considering that it's trying to shut down the stream,
see the other thread), we can end up returning `true` from `get_output_buffer`
without touching the `frame_count`. `output_frames` is not zero because it's
containing garbage. Also `output_buffer` has probably an invalid value. We
probably allocate a massive buffer because we find that we don't have enough
input data in the linarized input buffer, possibly OOMing in the process.
If not, we call the call back, run the graph, and end up crashing somewhere
random in the MSG, possibly exactly at this crash location because we're
shutting down so no streams are writing to the output buffer until the logic
that fills in silence at the end.
This might fix
bug 1268719, not sure.
MozReview-Commit-ID: LMTEPIOxvf8
--- a/media/libcubeb/src/cubeb_wasapi.cpp
+++ b/media/libcubeb/src/cubeb_wasapi.cpp
@@ -691,18 +691,18 @@ bool get_output_buffer(cubeb_stream * st
/**
* This function gets input data from a input device, and pass it along with an
* output buffer to the resamplers. */
bool
refill_callback_duplex(cubeb_stream * stm)
{
HRESULT hr;
- float * output_buffer;
- size_t output_frames;
+ float * output_buffer = nullptr;
+ size_t output_frames = 0;
bool rv;
XASSERT(has_input(stm) && has_output(stm));
rv = get_input_buffer(stm);
if (!rv) {
return rv;
}