I am new to WebRTC, We have web portal which allows to make call browser to browser. Need to automate the making call process and analysis the call quality.
Able to automate the call making process using selenium with python binding. But stuck at call analysis part.
Let me explain the automation process so far I automated:
I opening two Chrome incognito instances and entering the required setting on both the chrome instances, enter the number of second browser to first and hit the call button.
the line is get connected.
Idea for testing the audio quality: - from microphone speak simple sentence like "Hello Welcome", to record I running the PyAudio script to capture the audio. for another instance I am running another PyAudio Script to capture the audio from speaker. but it is failing keep throwing the bad channel below is the code:
{
def record_music_speaker(self):
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100
RECORD_SECONDS = 10
WAVE_OUTPUT_FILENAME = "output.wav"
p = pyaudio.PyAudio()
for i in range(0, p.get_device_count()):
print(i, p.get_device_info_by_index(i)['name'])
device_index = int(input('Device index: '))
stream = p.open(format=FORMAT,
channels=CHANNELS,
rate=RATE,
input=True,
frames_per_buffer=CHUNK,
input_device_index=device_index)
print("* Speaker recording")
frames = []
for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):
data = stream.read(CHUNK)
frames.append(data)
print("* Speaker done recording")
stream.stop_stream()
stream.close()
p.terminate()
wf = wave.open(WAVE_OUTPUT_FILENAME, 'wb')
wf.setnchannels(CHANNELS)
wf.setsampwidth(p.get_sample_size(FORMAT))
wf.setframerate(RATE)
wf.writeframes(b''.join(frames))
wf.close()
}
Below are the devices index
(0, u'Microsoft Sound Mapper - Input')
(1, u'External Mic (Realtek High Defi')
(2, u'Microphone (Realtek High Defini')
(3, u'Microsoft Sound Mapper - Output')
(4, u'Realtek HD Audio 2nd output (Re')
(5, u'Speaker/HP (Realtek High Defini')
When ever I used 5 it throws below:
{
stream = Stream(self, *args, **kwargs)
File "C:\Python27\lib\site-packages\pyaudio.py", line 441, in __init__
self._stream = pa.open(**arguments)
IOError: [Errno -9998] Invalid number of channels
}
Any suggestion here to resolve the issue or better idea to do it
Thanks,
Rakesh