Closed Bug 944615 Opened 11 years ago Closed 11 years ago

gUM with audio on emulator fails

Categories

(Firefox OS Graveyard :: Emulator, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(blocking-b2g:-)

RESOLVED FIXED
1.3 Sprint 6 - 12/6
blocking-b2g -

People

(Reporter: slee, Assigned: slee)

References

Details

Attachments

(2 files, 1 obsolete file)

On emulator, when we calling gUM with audio, it fails. Because the mic on emulator only supports 8k audio. GIPS always initialized with 48k on B2G, [1]. 

[1] http://dxr.mozilla.org/mozilla-central/source/media/webrtc/trunk/webrtc/modules/audio_device/android/opensles_input.cc#314
Attached patch patch (obsolete) — Splinter Review
Making AudioHardwareGeneric supports more sampling frequency.
Attachment #8340947 - Flags: feedback?(vyang)
Attachment #8340947 - Flags: feedback?(mwu)
After enabling this, we might want to consider fixing the gUM mochitests to leverage real devices for audio instead the fake streams. That will get us better test coverage.
(In reply to StevenLee from comment #1)
> Making AudioHardwareGeneric supports more sampling frequency.

Note: this patch is to be applied to device/generic/goldfish of 'master' branch.  For emulator-jb, a similar thing has to be applied to device/generic/goldfish/audio/audio_hw.c:

  static size_t in_get_buffer_size(...)
  {
    return IN_BUFFER_SIZE;
  }
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #3)
>   static size_t in_get_buffer_size(...)

Correct: static size_t adev_get_input_buffer_size(...)
Comment on attachment 8340947 [details] [diff] [review]
patch

Review of attachment 8340947 [details] [diff] [review]:
-----------------------------------------------------------------

::: audio/AudioHardwareGeneric.cpp
@@ +210,5 @@
> +           return 1024*channelCount;
> +       } else {
> +           return 512*channelCount;
> +       }
> +    }

nit:

  uint32_t bytesPerSample = audio_bytes_per_sample(format);
  uint32_t samplesPerChannel = 0;

  if (sampleRate == 8000 || sampleRate == 16000) {
    samplesPerChannel = sampleRate / 50;
  } else if (sampleRate >= 44100) {
    samplesPerChannel = 512;
  } else {
    samplesPerChannel = 256;
  }

  return samplesPerChannel * channelCount * bytesPerSample;

::: audio/AudioHardwareGeneric.h
@@ +134,4 @@
>      virtual    void        closeInputStream(AudioStreamIn* in);
>  
>              void            closeOutputStream(AudioStreamOutGeneric* out);
> +    virtual size_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount);

nit: align to |closeOutputStream|.
Attachment #8340947 - Flags: feedback?(vyang) → feedback+
Blocks: 853356
Attached patch patch v2Splinter Review
Attachment #8340947 - Attachment is obsolete: true
Attachment #8340947 - Flags: feedback?(mwu)
Attachment #8342839 - Flags: review?(vyang)
Attachment #8342839 - Flags: review?(vyang) → review+
blocking-b2g: --- → koi?
Please have a pull request to https://github.com/mozilla-b2g/device_generic_goldfish/ :)
Assignee: nobody → slee
Assignee: slee → nobody
blocking-b2g: koi? → 1.3?
Attached file Pull request of patch
Assignee: nobody → slee
Plus this one for emulator to better support audio test
blocking-b2g: 1.3? → 1.3+
Blocks: b2g-emulator
Component: WebRTC: Audio/Video → Emulator
Product: Core → Firefox OS
As soon as this is pulled and installed, we need to land the test patch from bug 853356 (which is perma-orange without it, since it wants 44100Hz).  mwu: any chance of pull/install?
Flags: needinfo?(mwu)
Flags: needinfo?(mwu)
Keywords: checkin-needed
(In reply to Ivan Tsay (:ITsay) from comment #9)
> Plus this one for emulator to better support audio test

Tests won't block the release, so this isn't a blocker.
blocking-b2g: 1.3+ → -
Master: https://github.com/mozilla-b2g/device_generic_goldfish/commit/5be0a9c4b3c6c004786917fdb5bee248960d045b
Status: NEW → RESOLVED
Closed: 11 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → 1.3 Sprint 6 - 12/6
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: