i9300: Enable back forgotten ISO modes (1/2)

Change-Id: Icefcd8dee6848e684b6c0c191ee485ed973e4ce8
camera: Full support for HTC camera switch

* Adds the changes for using the "htcwc" switch.
* ICS commit: https://github.com/CyanogenMod/android_frameworks_base/commit/6fa3953df37f6744af7c777f4ac803d4df44af33

Change-Id: I845d628106e386608590df7a1ed4f635f655f140
framework/av: Fix AudioFlinger create track failure

- AudioFlinger track creation fails after mediaserver crash
- Mediaplayer doesn't register for new sessionId value if
  mediaserver crashes during a song switch of music player
  and it uses the old sessionId though sessionId values are
  reset by AudioFlinger.
  AudioFlinger assigns the same sessionId to Tone Generator
  and since strategies of these two session differ it would
  result in track creation failure.
- Fix this issue by registering for new sessionId for
  mediaplayer if mediaserver crashes in idle state

Change-Id: Icc8d204bec5d2fa97db17a7319904baa29115b19
audoflinger: Add A2DP Notifications.

LPAPlayer needs A2DP Notifications to support LPA over BT-A2DP
devices.

Change-Id: Ib43231fd51070059cbe876ec54ee7c542bf2caa3
libstagefright: Enable LPA playback on BT-A2DP devices.

-Applicable for msm8660, msm7630 & msm7627a.
-LPAPlayer need to be put in a new file for the above
 targets as proxy port kind of implemention that is used
 for LPA on BT in 8960 is not available for the above targets.
-Consider LPA & Tunnel player compilation only for  QCOM
 targets as it was in ICS.

Change-Id: I638bd8427a7420e7e27b711008e9c6a51fb761b5
libstagefright: Fix for LPA crash and timestamp issue

-Timestamps during LPA playback is incorrect.
Crash is observed during moving to next clip.
-Timestamp after seek is incorrect.
AudioFlinger does not call stop of LPA Audio session.
-Manage timestamps in LPAPlayer.
Call stop of LPA Audio session.

CRs-Fixed: 388808

(cherry picked from commit e839365b783893c8070da587dac8aa5cb56d63f4)

Change-Id: Icccfb7d2325beb0f19d85af67a6719171e3fa625
Cameera: Correct camera orientation for front sensor

Change-Id: I4bc1d02af41ce863631afcbffc07b64277f8f1fe
libstagefright: Enable encode and decode with composition offsets

- Add setprop to enable b-frame encoding
- Setup AVC and MPEG4 encoder parameters for b-frame encoding
- Wait for minimum required buffers if b-frame encoding is
  selected for timelapse recording
- Allow decoding clips with ctts version 1

Change-Id: If2d66577b25c4a001cf72f4f84af56d03dfa4e17
CRs-Fixed: 380462
frameworks/av: Fix ANR during voice call recording when call ends

- While doing voice call recording, when the call ends ANR observed
- When the call is disconnected, audio HAL receives -1 from driver and
  audio HAL propagates this error to AudioFlinger.  But AudioFlinger
  is not sending error status to audio source to stop recording.
  Because of this audiorecord thread keeps on waiting for buffers
  which is resulting in ANR.
- To avoid indefinite wait, a timeout of 1 sec is set for buffer
  in audioSource and after timeout, -ETIMEDOUT is returned
  to recorder thread.

Change-Id: Ifffa1a33a796c83ac819681b2bf4158c8a16f6ce
libstagefright: Fix for data loss in qcp recording

- For evrc and qcelp recording, nearly 1 sec of data which is
  recorded is not writtern to the recorded clip.
- The writer thread which writes the encoded data to .qcp file,
  is not getting enough CPU time. This results in ~500ms of data
  loss in the recorded clip.
- Fix is to increase the priority of the writer thread to
  ANDROID_PRIORITY_AUDIO

Change-Id: I19125593ade2697251df976c81cb4df8dcf7b80b
CRs-fixed: 386398
libstagefright: Fix for CTS recording testcase failure

- AMR WB record is failing through CTS because of incorrect
  sample rate and bitrate values. Fix AMR WB encode
  bitrate and sampling rate values to fix this issue.
- Back to back recording in CTS testcase
  MediaRecorderTest#testRecordingAudioInRawFormats fails.
  Add a fix to release audio source node reference on stop
  recording as well as before creating new audio source.

Change-Id: Ia4b1f2331b0b6f9c6c7d23cd40e8c5b5cec76e28
CRs-fixed: 384336
libstagefright: Fix for FPS drop issue during A-V playback.

Issues:
-The AAC decoder was not updating the timestamp when EOS is reached.
-Logic to smoothen the real time update in AudioPlayer uses system
 time. This introduces corrupt timestamp during EOS.

Fix:
-Update the timestamp in AAC decoder when EOS is reached.
-Extrapolate realtime using system time in AudioPlayer when EOS is
 reached. Cap the value to realtime if  extrapolated time becomes greater
 than realtime.

CRs-Fixed: 384183
Change-Id: Ice54501436431d2527fcd3d710d65d9732fcffdd
frameworks/av : Added key to query a2dp device support

Change-Id: I0440ab83cfcabbecb336c12e2e8db0778e7b936b
libstagefright: Reduce number of video events posted when frame is early

Current av sync logic posts an early video frame with a delay of 10 ms.
This may result in multiple video events being posted before the frame
gets rendered. Update the delay for posting an early frame to the difference
between the lateness and early margin.

Change-Id: I619b75cf1b2ed83ab9e07bf26ad759d7c03fb4f4
frameworks/av: Fix for video playback failure in browser

- Issue: After camping the Signal to 3G network, open the browser
and go to www.youtube.com and play any video. Video playback is
failing after trying to load the video for few seconds. Browser is
coming back to video's list.

- Cause: At the beginning of playback, as there was a seek request
pending, seek is done before starting the AudioPlayer. After
AudioSource seeking, AudioPlayer start is called with OMX in PAUSED
state, causing assert check fail for OMX state.

- Fix: Call AudioSource start before calling AudioPlayer start, so that
OMX moves to EXECUTING state.

(Fix is ported from ICS I4e746bf0b5167d4998fd900bbce3966a2dc1273d)
CRs-Fixed: 395384

Change-Id: Id4f7e8658ba96b28533d11d34d4622ea6106615d
libstagefright: Checks before freeing buffers on a port

- OMXCodec calls dequeueBuffer on the NativeWindow in a loop
  and registers output buffers with the OMX component.
- If a dequeueBuffer fails, the buffers already registered
  with the OMX component were not getting freed laeding
  to a memory leak.
- On an error, check state of OMXCodec before freeing buffers on a port.

CRs-Fixed: 393352

Change-Id: I0d745fc299a9f55fcbf0f9e14744d12198e96f42
framework/av: Fix to handle corrupted .m4a clips

- Some m4a clips with corrupted header causes native crash
  in mediaserver.
- This is due to a wrong sample size which had to read from the clip.
- Fixed this by checking for the sample size extracted from the clip
  against the mediabuffer size.

Change-Id: If19b4bb2b99fb5558ed78d55d4e53fd03f6f8c73
frameworks/av: Fix NULL Pointer exception issue

- Issue is seen when using third party market app.
- Fix the issue by checking for NULL pointer for param2 in
   ioConfigChanged API

Change-Id: I97ac0797332111357b4a7d4a812b1c9df7ce9f0b
libstagefright: Disable multi-slicing in mpeg4 video recording.

Multi-slicing is not required for the camcorder use case.
Disables multi-slicing for mpeg4 video encoding in camcorder.

Change-Id: I422cc285af174393de43a2f4905f0e67359df2af
framework/av:: Add support to decode mp3 data in mp4 container

- Added support to decode mp3 data in mp4 container packed as mp4a
  atom and .mp3 atom as well.

Change-Id: I1a04022f30a9f6516575440aba7652986ab7dc58