Skip to content
Snippets Groups Projects
Commit 5973df1a authored by Karl Tomlinson's avatar Karl Tomlinson
Browse files

Bug 1801190 clarify that MockCubebStream needs the same memory layout as cubeb_stream r=padenot

to save problems if/when further members are added.

cubeb_stream_user_ptr() is not used/tested right now, but this change will
make that behave as expected.

Differential Revision: https://phabricator.services.mozilla.com/D173925
parent e4af65f7
No related branches found
No related tags found
No related merge requests found
......@@ -146,6 +146,7 @@ MockCubebStream::MockCubebStream(cubeb* aContext, cubeb_devid aInputDevice,
void* aUserPtr, SmartMockCubebStream* aSelf,
bool aFrozenStart)
: context(aContext),
mUserPtr(aUserPtr),
mHasInput(aInputStreamParams),
mHasOutput(aOutputStreamParams),
mSelf(aSelf),
......@@ -153,7 +154,6 @@ MockCubebStream::MockCubebStream(cubeb* aContext, cubeb_devid aInputDevice,
mFrozenStart(aFrozenStart),
mDataCallback(aDataCallback),
mStateCallback(aStateCallback),
mUserPtr(aUserPtr),
mInputDeviceID(aInputDevice),
mOutputDeviceID(aOutputDevice),
mAudioGenerator(aInputStreamParams ? aInputStreamParams->channels
......
......@@ -137,6 +137,12 @@ class SmartMockCubebStream;
// Represents the fake cubeb_stream. The context instance is needed to
// provide access on cubeb_ops struct.
class MockCubebStream {
// These members need to have the exact same memory layout as a real
// cubeb_stream, so that AsMock() returns a pointer to this that can be used
// as a cubeb_stream.
cubeb* context;
void* mUserPtr;
public:
MockCubebStream(cubeb* aContext, cubeb_devid aInputDevice,
cubeb_stream_params* aInputStreamParams,
......@@ -194,9 +200,6 @@ class MockCubebStream {
void Process10Ms();
private:
cubeb* context = nullptr;
public:
const bool mHasInput;
const bool mHasOutput;
......@@ -229,8 +232,6 @@ class MockCubebStream {
cubeb_state_callback mStateCallback = nullptr;
// The device changed callback
cubeb_device_changed_callback mDeviceChangedCallback = nullptr;
// Stream's user data
void* mUserPtr = nullptr;
// The stream params
cubeb_stream_params mOutputParams = {};
cubeb_stream_params mInputParams = {};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment