Ejemplo n.º 1
0
 def _play_heaac_5_1ch_audio(self):
     fname = "HE_AAC_32kHz_5.1ch_6min_550Hz_sinewave.mp4"
     fpath = resource.get_media_content(fname)
     dut_path = "/sdcard/" + fname
     self.tmpfiles_dut.append(dut_path)
     self.adb.push_file(fpath, dut_path)
     self.rpc.playFile(dut_path)
Ejemplo n.º 2
0
 def deploy_play_music_content(self, files=[]):
     if not files:
         files = self.DEFAULT_CONTENTS
     for f in files:
         local_path = resource.get_media_content(f)
         push_path = os.path.join(self.MEDIA_PATH, f)
         self.push_file(local_path, push_path)
     self._refresh_storage()
 def appPrepare(self, case_name=None):
     self.audio.cfg = self.config.read(self.CONFIG_FILE, case_name)
     g_common_obj2.adb_cmd_capture_msg(self.audio.cfg.get("remove_audio"))
     self.file_name = self.audio.cfg.get("push_audio").split("/")[-1].replace("\"","")
     self.push_path = self.audio.cfg.get("push_audio").split("\" \"")[1].replace("\"","")
     ret_file = resource.get_media_content(self.file_name)
     g_common_obj2.adb_cmd_common("push \"" + ret_file + "\" " + "\"" + self.push_path + "\"")
     g_common_obj2.adb_cmd_capture_msg(self.audio.cfg.get("refresh_sd"))
     self.audio.set_orientation_n()
     self.audio.cleanUpData()
Ejemplo n.º 4
0
 def download_push_content(self, device, content, path):
     """
     Download and push file to DUT
     """
     self.logger.debug("Download and push content: %s"%content)
     if not device:
         device = self.get_test_device()
     if "/" in content:
         cnt = resource.get_other_content(content)
     else:
         cnt = resource.get_media_content(content)
     push_path = os.path.join(path, os.path.basename(cnt))
     if not device.push_file(cnt, push_path):
         self.logger.error("Push media content failed! %s"%content)
         return False
     return True
Ejemplo n.º 5
0
    def testAudioEncode_BTHSP_Mono(self):
        ''' Verify that can capture mono voice memo over BT HSP '''
        self.bt.connect(True)
        self.rpc.enableSco(True)  # enable BTHSP SCO
        time.sleep(1)
        record_path = "/sdcard/sco_record.amrwb"
        self.adb.adb_cmd("rm " + record_path)  # remove file if exists
        self.rpc.startRecording(record_path)
        # play sco.wav through BTHSP mic
        sco_wav = get_media_content("sco.wav")
        self.bt.sco.send_wav_file(sco_wav)
        time.sleep(30)

        self.rpc.stopRecording()
        self.rpc.enableSco(False)

        # check if we can play record file
        self.rpc.playFile(record_path)
        time.sleep(2)
        self.assertTrue(self.rpc.isPlaying(), "Can't play record file")
        self.adb.adb_cmd("rm " + record_path)
        self.rpc.enableSco(False)
Ejemplo n.º 6
0
 def _wsHS_connect_disconnect(self, delay, count):
     '''
     connect/disconnect wired HS iterative
     during DUT idle/music playback/memo record
     '''
     # idle
     for _ in range(count):
         self.hs.plug_in()
         time.sleep(delay)
         self.hs.plug_out()
         time.sleep(delay)
     # music playback
     self.rpc.playLong()
     for _ in range(count):
         self.hs.plug_in()
         time.sleep(delay)
         assert self.rpc.isStreamActive("music", 500), \
             "music not active when headset plug in"
         self.hs.plug_out()
         time.sleep(delay)
         assert self.rpc.isStreamActive("music", 500), \
             "music not active when headset plug out"
     self.rpc.resetPlayer()
     # record
     memo_name = 'AMR-NB_mono_8KHz_12.2Kbps.amr'
     memo_record = resource.get_media_content(memo_name)
     dut_path = '/sdcard/' + memo_name
     self.adb.push_file(memo_record, dut_path)
     self.rpc.playFile(dut_path)
     for _ in range(count):
         self.hs.plug_in()
         time.sleep(delay)
         assert self.rpc.isStreamActive("music", 500), \
             "memo not active when headset plug in"
         self.hs.plug_out()
         time.sleep(delay)
         assert self.rpc.isStreamActive("music", 500), \
             "memo not active when headset plug out"
Ejemplo n.º 7
0
 def get_media_file(self):
     fpath = resource.get_media_content("large_audio_file.mp3")
     if not os.path.isfile(fpath):
         raise Exception("media file not found")
     return fpath