StagefrightRecorder: correct the flow of resuming or stopping from pause

1. resume from pause: start the writer first, to avoid frames dropped by
writer due to writer is not started, which caused mosaic frames.

2. stop from pause:  don't start writer, just start encoders and sources,
to avoid unwanted frames are written into clips when stopping in
paused state.

3. recover the pause(dropping frames) in MPEG4Writer.

Change-Id: I4f8f275bce6ac7bc3d4f31f372cc86b362b6c587
CRs-Fixed: 695750 695745

Conflicts:
	media/libmediaplayerservice/StagefrightRecorder.cpp
libstagefright: fix issues in AH263Assembler

- if the received rtp packet belongs to the current
  candidate access unit but arrived later, this packet
  still needs to be inserted into this access unit before
  submitting it. Otherwise this incomplete unit would be
  sent to the decoder and cause some potential errors.

- move the functionality for checking the malformed packet
  and calculating the offset of the payload header to one
  function.

Crs-Fixed: 694476
Change-Id: Ie66524ac4b130c443c12bfb007593e5eb4a24019
frameworks/av: miscellaneous fixes

fixes for the following issues reported by KW

5978, 8879, 8880, 8881, 8882, 8883, 8889, 8890,
8892, 8893, 9200, 9201, 10210, 11223, 11224, 18001,
83677, 84525, 5897

Change-Id: I9bb98a07af97cbfc746b21738dfce7cd9e128c94

Conflicts:
	media/libstagefright/ExtendedCodec.cpp
	media/libstagefright/ExtendedUtils.cpp
libstagefright: poke the udp hole twice for future incoming udp packets

- only firing off udp packets once to the source address or the endpoint
  could still be limited in some NAT network environment. As a result,
  client can't receive rtp packets over udp.

- send udp packets to both of the two addresses if they are available.

Change-Id: I7e8a0b36a82bcd85b307c9c15dcfee2bcd7e6030
rtsp: keep some damaged access unit to enhance fault tolerance

Make RTSPSource to accept some damaged access units of H263 to enhance
fault tolerance. Without this patch, damaged access can cause failure of
playback.

Change-Id: I905648f8b30fefa6ec8de18f943ede87641d7300
CRs-Fixed: 687252