roufshah / spydroid-ipcamera

Automatically exported from code.google.com/p/spydroid-ipcamera
GNU General Public License v3.0
0 stars 0 forks source link

The profile of the output AAC file maybe diff with the same audio para #146

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Sometimes, the AAC output is not support by ffplay, as the AAC profile is SSR.

What steps will reproduce the problem?
1. To reproduce it easily, I mark the code about get AAC config from setting, 
but always record it to file, and log the profile.  
2. You will find the profile will be different, even using the same input 
param, log as flow:
I/AACStream(18524): Input: Source: 1 Format:6 Encoder:3 CH:2 Rate:44100 
BitRate:16000
I/AACStream(18524): Output:  Profile:4 CH:2 Rate:44100  

I/AACStream(18524): Input: Source: 1 Format:6 Encoder:3 CH:2 Rate:44100 
BitRate:16000
I/AACStream(18524): Output:  Profile:1 CH:2 Rate:44100
3. Samsung S4 profile will be 3(SSR), and ffplay is not support. 

What is the expected output? What do you see instead?
The profile should be the same.

What version of the product are you using? On what operating system?
I have try Samsung S4, Xiaomi 4. They are all may change the profile. 

Please provide any additional information below.

Original issue reported on code.google.com by phymurb...@gmail.com on 4 Mar 2015 at 10:32

GoogleCodeExporter commented 8 years ago
I found the cause, it is the google android bugs:
While the recorder record the AAC to fd, the AACWriter does not init the 
profile(only init it while record to file).

As below:
mAACProfile(OMX_AUDIO_AACObjectLC) not init in the AACWriter(fd). 

AACWriter::AACWriter(const char *filename)
    : mFd(-1),
      mInitCheck(NO_INIT),
      mStarted(false),
      mPaused(false),
      mResumed(false),
      mChannelCount(-1),
      mSampleRate(-1),
      mAACProfile(OMX_AUDIO_AACObjectLC) {

    ALOGV("AACWriter Constructor");

    mFd = open(filename, O_CREAT | O_LARGEFILE | O_TRUNC | O_RDWR, S_IRUSR | S_IWUSR);
    if (mFd >= 0) {
        mInitCheck = OK;
    }
}

AACWriter::AACWriter(int fd)
    : mFd(dup(fd)),
      mInitCheck(mFd < 0? NO_INIT: OK),
      mStarted(false),
      mPaused(false),
      mResumed(false),
      mChannelCount(-1),
      mSampleRate(-1) {
}

Original comment by phymurb...@gmail.com on 4 Mar 2015 at 11:44