title: Which AVC profile/level will be set in Android MediaCodec if we don't set this value manually?
body: <p>In Android ACodec.cpp <code>setupAVCEncoderParameters</code>, it reads <code>profile</code> and <code>level</code> from <code>msg</code>(<code>msg-&gt;findInt32("profile", &amp;profile)</code>/<code>msg-&gt;findInt32("level", &amp;level)</code>), the <code>msg</code> appears to be coming from <code>format</code> in <code>MediaCodec.configure()</code>. So, I think we can set <code>profile</code>/<code>level</code> manually before <code>MediaCodec.configure()</code> like below:</p>
  
  <pre><code>format.setInteger(MediaCodec.KEY_PROFILE, MediaCodecInfo.CodecProfileLevel.AVCProfileHigh);
  format.setInteger(MediaCodec.KEY_LEVEL, MediaCodecInfo.CodecProfileLevel.AVCLevel5);
  </code></pre>
  
  <p>Of course, I agree it's not a good idea, because we don't konw if our device support the profile/level we set. And also I find most example code didn't set these values at all.</p>
  
  <p>For example: </p>
  
  <pre><code>MediaFormat format = MediaFormat.createVideoFormat(MIME_TYPE, mWidth, mHeight);
  format.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);  // API &gt;= 18
  format.setInteger(MediaFormat.KEY_BIT_RATE, calcBitRate());
  format.setInteger(MediaFormat.KEY_FRAME_RATE, FRAME_RATE);
  format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 10)
  
  mMediaCodec = MediaCodec.createEncoderByType(MIME_TYPE);
  mMediaCodec.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
  </code></pre>
  
  <p>Maybe they will be set automatically? Will MediaCodec query which profile/level current device support and choose one automatically? If device support more than one profile/level, which one will be selected? The lower level one(baseline, e.g.) or the higher level one(high, e.g.)?</p>