WebRTC——AudioSource、VideoSource解析

AudioSource和VideoSource都是MediaSource的子類(lèi),它們同樣是包裹在C++外的一層,它們的功能是承載一個(gè)或多個(gè)AudioTrack/VideoTrack。

//AudioSource完全繼承了父類(lèi),并沒(méi)有任何的重寫(xiě)
public class AudioSource extends MediaSource {
  public AudioSource(long nativeSource) {
    super(nativeSource);
  }
}
//同樣是繼承了父類(lèi)的所有的方法,但是新增了一個(gè)方法是,適應(yīng)外界輸出的分辨率
public VideoSource(long nativeSource) {
    super(nativeSource);
  }

  /**
   * Calling this function will cause frames to be scaled down to the requested resolution. Also,
   * frames will be cropped to match the requested aspect ratio, and frames will be dropped to match
   * the requested fps. The requested aspect ratio is orientation agnostic and will be adjusted to
   * maintain the input orientation, so it doesn't matter if e.g. 1280x720 or 720x1280 is requested.
   */
  public void adaptOutputFormat(int width, int height, int fps) {
    nativeAdaptOutputFormat(nativeSource, width, height, fps);
  }

  private static native void nativeAdaptOutputFormat(
      long nativeSource, int width, int height, int fps);
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容