media: miscellaneous fixes to VT contribution

- fix MediaSource.h path
- fix setDataSource binder code
- use MediaCodecConstants instead of OMX/ACodec constants
- fix spacing
- fix typos
- remove unused code
- commented some tricky code segments
- AAVC/HEVCAssembler: re-read next buffer if buffer was deleted
- RTPSource: pull out constants kMinVideoBitrate and kBufferingPollIntervalUs
- RTPSource: check state early in prepareAsync
- RTPSource: fix potential null dereference in setSource
- ARTPAssembler: make showing queue runtime configurable via debug.stagefright.rtp bool property
- ARTPWriter: fix security issues: protect against reading OOB in
  sendSPSPPSIfIFrame and StripStartcode
- ARTPWriter: free buffers early in destructor
- ARTPWriter: create PPS buffer only if there is PPS
- ARTPConnection: fix security issues: protect against reading OOB in
  parseRTPExt, parseTSFB, and parsePSFB. Also remove remote null-dereference.
- AHEVCAssembler: fix security issues: protect against reading OOB in
  addFragmentedNALUnit

Bug: 121230209
Test: build
Change-Id: Iada8b878e396452c1d281c60f3754e13e34bcddb
diff --git a/media/libmedia/IMediaPlayer.cpp b/media/libmedia/IMediaPlayer.cpp
index 7eadd25..c08d187 100644
--- a/media/libmedia/IMediaPlayer.cpp
+++ b/media/libmedia/IMediaPlayer.cpp
@@ -697,7 +697,7 @@
         }
         case SET_DATA_SOURCE_RTP: {
             CHECK_INTERFACE(IMediaPlayer, data, reply);
-            const String8& rtpParams = data.readString8();
+            String8 rtpParams = data.readString8();
             reply->writeInt32(setDataSource(rtpParams));
             return NO_ERROR;
         }
diff --git a/media/libmedia/include/media/mediarecorder.h b/media/libmedia/include/media/mediarecorder.h
index 41b1d2e..fbcdb28 100644
--- a/media/libmedia/include/media/mediarecorder.h
+++ b/media/libmedia/include/media/mediarecorder.h
@@ -292,7 +292,7 @@
     Mutex                       mLock;
     Mutex                       mNotifyLock;
 
-    int                         mOutputFormat;
+    output_format               mOutputFormat;
 };
 
 };  // namespace android
diff --git a/media/libmedia/mediarecorder.cpp b/media/libmedia/mediarecorder.cpp
index 87c9377..d9d1f25 100644
--- a/media/libmedia/mediarecorder.cpp
+++ b/media/libmedia/mediarecorder.cpp
@@ -244,7 +244,7 @@
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
-    mOutputFormat = of;
+    mOutputFormat = (output_format)of;
     mCurrentState = MEDIA_RECORDER_DATASOURCE_CONFIGURED;
     return ret;
 }
@@ -745,7 +745,7 @@
     mIsAudioEncoderSet = false;
     mIsVideoEncoderSet = false;
     mIsOutputFileSet   = false;
-    mOutputFormat      = 0;
+    mOutputFormat      = OUTPUT_FORMAT_DEFAULT;
 }
 
 // Release should be OK in any state