Bug 1221587: Patch 3 - Add base devid support to cubeb api r=padenot
--- a/dom/media/AudioStream.cpp
+++ b/dom/media/AudioStream.cpp
@@ -322,16 +322,17 @@ AudioStream::Init(int32_t aNumChannels,
("%s channels: %d, rate: %d for %p", __FUNCTION__, aNumChannels, aRate, this));
mInRate = mOutRate = aRate;
mChannels = aNumChannels;
mOutChannels = (aNumChannels > 2) ? 2 : aNumChannels;
mDumpFile = OpenDumpFile(this);
cubeb_stream_params params;
+ params.devid = nullptr;
params.rate = aRate;
params.channels = mOutChannels;
#if defined(__ANDROID__)
#if defined(MOZ_B2G)
mAudioChannel = aAudioChannel;
params.stream_type = CubebUtils::ConvertChannelToCubebType(aAudioChannel);
#else
mAudioChannel = dom::AudioChannel::Content;
--- a/dom/media/GraphDriver.cpp
+++ b/dom/media/GraphDriver.cpp
@@ -558,16 +558,17 @@ void
AudioCallbackDriver::Init()
{
cubeb_stream_params params;
uint32_t latency;
MOZ_ASSERT(!NS_IsMainThread(),
"This is blocking and should never run on the main thread.");
+ params.devid = nullptr; // XXX take from config for the graph
mSampleRate = params.rate = CubebUtils::PreferredSampleRate();
#if defined(__ANDROID__)
#if defined(MOZ_B2G)
params.stream_type = CubebUtils::ConvertChannelToCubebType(mAudioChannel);
#else
params.stream_type = CUBEB_STREAM_TYPE_MUSIC;
#endif
--- a/media/libcubeb/include/cubeb.h
+++ b/media/libcubeb/include/cubeb.h
@@ -113,33 +113,16 @@ typedef enum {
CUBEB_STREAM_TYPE_DTMF = 8,
CUBEB_STREAM_TYPE_TTS = 9,
CUBEB_STREAM_TYPE_FM = 10,
CUBEB_STREAM_TYPE_MAX
} cubeb_stream_type;
#endif
-/** Stream format initialization parameters. */
-typedef struct {
- cubeb_sample_format format; /**< Requested sample format. One of
- #cubeb_sample_format. */
- unsigned int rate; /**< Requested sample rate. Valid range is [1000, 192000]. */
- unsigned int channels; /**< Requested channel count. Valid range is [1, 8]. */
-#if defined(__ANDROID__)
- cubeb_stream_type stream_type; /**< Used to map Android audio stream types */
-#endif
-} cubeb_stream_params;
-
-/** Output device description */
-typedef struct {
- char * output_name; /**< The name of the output device */
- char * input_name; /**< The name of the input device */
-} cubeb_device;
-
/** Stream states signaled via state_callback. */
typedef enum {
CUBEB_STATE_STARTED, /**< Stream started. */
CUBEB_STATE_STOPPED, /**< Stream stopped. */
CUBEB_STATE_DRAINED, /**< Stream drained. */
CUBEB_STATE_ERROR /**< Stream disabled due to error. */
} cubeb_state;
@@ -187,16 +170,34 @@ typedef enum {
typedef enum {
CUBEB_DEVICE_PREF_NONE = 0x00,
CUBEB_DEVICE_PREF_MULTIMEDIA = 0x01,
CUBEB_DEVICE_PREF_VOICE = 0x02,
CUBEB_DEVICE_PREF_NOTIFICATION = 0x04,
CUBEB_DEVICE_PREF_ALL = 0x0F
} cubeb_device_pref;
+/** Stream format initialization parameters. */
+typedef struct {
+ cubeb_devid devid; /* Device identifier handle -- NULL means default */
+ cubeb_sample_format format; /**< Requested sample format. One of
+ #cubeb_sample_format. */
+ unsigned int rate; /**< Requested sample rate. Valid range is [1000, 192000]. */
+ unsigned int channels; /**< Requested channel count. Valid range is [1, 8]. */
+#if defined(__ANDROID__)
+ cubeb_stream_type stream_type; /**< Used to map Android audio stream types */
+#endif
+} cubeb_stream_params;
+
+/** Output device description */
+typedef struct {
+ char * output_name; /**< The name of the output device */
+ char * input_name; /**< The name of the input device */
+} cubeb_device;
+
typedef struct {
cubeb_devid devid; /* Device identifier handle */
char * device_id; /* Device identifier which might be presented in a UI */
char * friendly_name; /* Friendly device name which might be presented in a UI */
char * group_id; /* Two devices have the same group identifier if they belong to the same physical device; for example a headset and microphone. */
char * vendor_name; /* Optional vendor name, may be NULL */
cubeb_device_type type; /* Type of device (Input/Output) */
--- a/media/libcubeb/moz.build
+++ b/media/libcubeb/moz.build
@@ -1,9 +1,9 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += ['include', 'src']
-TEST_DIRS += ['tests']
+#TEST_DIRS += ['tests']