Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2013-02-22 20:21:57 (GMT)
committer Walter Bender <walter.bender@gmail.com>2013-02-22 20:21:57 (GMT)
commit6dc36f4c3cb8d5bc07afd521daa5aedc55d7cf77 (patch)
tree6d761c1b9e01c792c1c47d85a95f44f8ca3936ed
parent2461b8ce02a9dbb3d5a3628f205c0bb3b6144ee4 (diff)
16000 does not work on xo4
-rw-r--r--NEWS2
-rw-r--r--grecord.py12
2 files changed, 12 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 79270dc..ac86523 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ BUG FIXES:
* Fixed problem indentifying hardware on some systems
* Fixed problem with screen rotation
* Fixed problems with sharing introduced during GTK-3 port
+* Record audio at 48000 instead of 16000 so as to make it more
+ reliable (on some hardware)
39
diff --git a/grecord.py b/grecord.py
index 87bf390..f07323c 100644
--- a/grecord.py
+++ b/grecord.py
@@ -52,6 +52,7 @@ class Grecord:
bus = self._pipeline.get_bus()
bus.add_signal_watch()
bus.connect('message', self._bus_message_handler)
+ _logger.debug('Grecord.__init__ complete')
def _create_audiobin(self):
src = Gst.ElementFactory.make('alsasrc', None)
@@ -69,7 +70,7 @@ class Grecord:
src.set_property('device', 'default')
srccaps = Gst.caps_from_string(
- 'audio/x-raw,rate=(int)16000,channels=(int)1,depth=(int)16')
+ 'audio/x-raw,rate=(int)48000,channels=(int)1,depth=(int)16')
# Guarantee perfect stream, important for A/V sync
rate = Gst.ElementFactory.make('audiorate', None)
@@ -87,6 +88,7 @@ class Grecord:
enc = Gst.ElementFactory.make('wavenc', None)
sink = Gst.ElementFactory.make('filesink', None)
+ _logger.debug(os.path.join(self._activity.datapath, 'output.wav'))
sink.set_property('location',
os.path.join(self._activity.datapath, 'output.wav'))
@@ -101,6 +103,7 @@ class Grecord:
rate.link(queue)
queue.link(enc)
enc.link(sink)
+ _logger.debug('audio_bin complete')
def _log_queue_overrun(self, queue):
cbuffers = queue.get_property('current-level-buffers')
@@ -143,6 +146,8 @@ class Grecord:
_logger.error('output.wav does not exist or is empty')
return
+ _logger.debug('stop_recording_audio')
+
line = 'filesrc location=' + audio_path + ' name=audioFilesrc ! \
wavparse name=audioWavparse ! audioconvert name=audioAudioconvert ! \
vorbisenc name=audioVorbisenc ! oggmux name=audioOggmux ! \
@@ -167,6 +172,7 @@ filesink name=audioFilesink'
def transcoding_complete(self):
# The EOS message is sometimes either not sent or not received.
# So if the position in the stream is not advancing, assume EOS.
+ _logger.debug('transcoding complete')
if self._transcode_id is None:
_logger.debug('EOS.... transcoding finished')
return True
@@ -193,6 +199,7 @@ filesink name=audioFilesink'
# this results in several seconds of silence being added at the start
# of the recording. So we stop the whole pipeline while adjusting it.
# SL#2040
+ _logger.debug('record audio')
self._pipeline.set_state(Gst.State.NULL)
self._pipeline.add(self._audiobin)
self.play()
@@ -234,7 +241,8 @@ filesink name=audioFilesink'
pipe.get_bus().disable_sync_message_emission()
wavFilepath = os.path.join(self._activity.datapath, 'output.wav')
- os.remove(wavFilepath)
+ _logger.debug('skip clean up of output.wav')
+ # os.remove(wavFilepath)
return
def _bus_message_handler(self, bus, message):