mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 953265: Update webrtc/getUserMedia default audio capture rate to 32KHz r=padenot
This commit is contained in:
parent
7ae59e77ce
commit
46bfe823f7
@ -54,6 +54,12 @@ public:
|
||||
static const int DEFAULT_169_VIDEO_HEIGHT = 720;
|
||||
static const int DEFAULT_AUDIO_TIMER_MS = 10;
|
||||
|
||||
#ifndef MOZ_B2G
|
||||
static const int DEFAULT_SAMPLE_RATE = 32000;
|
||||
#else
|
||||
static const int DEFAULT_SAMPLE_RATE = 16000;
|
||||
#endif
|
||||
|
||||
/* Populate an array of video sources in the nsTArray. Also include devices
|
||||
* that are currently unavailable. */
|
||||
virtual void EnumerateVideoDevices(dom::MediaSourceEnum,
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "YuvStamper.h"
|
||||
#endif
|
||||
|
||||
#define AUDIO_RATE 16000
|
||||
#define AUDIO_RATE mozilla::MediaEngine::DEFAULT_SAMPLE_RATE
|
||||
#define AUDIO_FRAME_LENGTH ((AUDIO_RATE * MediaEngine::DEFAULT_AUDIO_TIMER_MS) / 1000)
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -137,6 +137,7 @@ public:
|
||||
, mChannel(-1)
|
||||
, mInitDone(false)
|
||||
, mStarted(false)
|
||||
, mSampleFrequency(MediaEngine::DEFAULT_SAMPLE_RATE)
|
||||
, mEchoOn(false), mAgcOn(false), mNoiseOn(false)
|
||||
, mEchoCancel(webrtc::kEcDefault)
|
||||
, mAGC(webrtc::kAgcDefault)
|
||||
@ -225,6 +226,7 @@ private:
|
||||
nsString mDeviceName;
|
||||
nsCString mDeviceUUID;
|
||||
|
||||
uint32_t mSampleFrequency;
|
||||
bool mEchoOn, mAgcOn, mNoiseOn;
|
||||
webrtc::EcModes mEchoCancel;
|
||||
webrtc::AgcModes mAGC;
|
||||
|
@ -19,9 +19,8 @@
|
||||
#define ENCODING "L16"
|
||||
#define DEFAULT_PORT 5555
|
||||
|
||||
#define SAMPLE_RATE 256000
|
||||
#define SAMPLE_FREQUENCY 16000
|
||||
#define SAMPLE_LENGTH ((SAMPLE_FREQUENCY*10)/1000)
|
||||
#define SAMPLE_RATE(freq) ((freq)*2*8) // bps, 16-bit samples
|
||||
#define SAMPLE_LENGTH(freq) (((freq)*10)/1000)
|
||||
|
||||
// These are restrictions from the webrtc.org code
|
||||
#define MAX_CHANNELS 2
|
||||
@ -345,7 +344,7 @@ MediaEngineWebRTCMicrophoneSource::Start(SourceMediaStream *aStream,
|
||||
}
|
||||
|
||||
AudioSegment* segment = new AudioSegment();
|
||||
aStream->AddAudioTrack(aID, SAMPLE_FREQUENCY, 0, segment, SourceMediaStream::ADDTRACK_QUEUED);
|
||||
aStream->AddAudioTrack(aID, mSampleFrequency, 0, segment, SourceMediaStream::ADDTRACK_QUEUED);
|
||||
|
||||
// XXX Make this based on the pref.
|
||||
aStream->RegisterForAudioMixing();
|
||||
@ -470,6 +469,9 @@ MediaEngineWebRTCMicrophoneSource::Init()
|
||||
return;
|
||||
}
|
||||
|
||||
mSampleFrequency = MediaEngine::DEFAULT_SAMPLE_RATE;
|
||||
LOG(("%s: sampling rate %u", __FUNCTION__, mSampleFrequency));
|
||||
|
||||
// Check for availability.
|
||||
ScopedCustomReleasePtr<webrtc::VoEHardware> ptrVoEHw(webrtc::VoEHardware::GetInterface(mVoiceEngine));
|
||||
if (!ptrVoEHw || ptrVoEHw->SetRecordingDevice(mCapIndex)) {
|
||||
@ -495,9 +497,10 @@ MediaEngineWebRTCMicrophoneSource::Init()
|
||||
webrtc::CodecInst codec;
|
||||
strcpy(codec.plname, ENCODING);
|
||||
codec.channels = CHANNELS;
|
||||
codec.rate = SAMPLE_RATE;
|
||||
codec.plfreq = SAMPLE_FREQUENCY;
|
||||
codec.pacsize = SAMPLE_LENGTH;
|
||||
MOZ_ASSERT(mSampleFrequency == 16000 || mSampleFrequency == 32000);
|
||||
codec.rate = SAMPLE_RATE(mSampleFrequency);
|
||||
codec.plfreq = mSampleFrequency;
|
||||
codec.pacsize = SAMPLE_LENGTH(mSampleFrequency);
|
||||
codec.pltype = 0; // Default payload type
|
||||
|
||||
if (!ptrVoECodec->SetSendCodec(mChannel, codec)) {
|
||||
|
@ -48,6 +48,9 @@
|
||||
|
||||
#include "logging.h"
|
||||
|
||||
// Should come from MediaEngineWebRTC.h, but that's a pain to include here
|
||||
#define DEFAULT_SAMPLE_RATE 32000
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::layers;
|
||||
@ -1332,7 +1335,7 @@ void GenericReceiveListener::AddSelf(MediaSegment* segment) {
|
||||
MediaPipelineReceiveAudio::PipelineListener::PipelineListener(
|
||||
SourceMediaStream * source, TrackID track_id,
|
||||
const RefPtr<MediaSessionConduit>& conduit, bool queue_track)
|
||||
: GenericReceiveListener(source, track_id, 16000, queue_track), // XXX rate assumption
|
||||
: GenericReceiveListener(source, track_id, DEFAULT_SAMPLE_RATE, queue_track), // XXX rate assumption
|
||||
conduit_(conduit)
|
||||
{
|
||||
MOZ_ASSERT(track_rate_%100 == 0);
|
||||
|
Loading…
Reference in New Issue
Block a user