Java Code Examples for com.google.android.exoplayer2.C#NANOS_PER_SECOND

The following examples show how to use com.google.android.exoplayer2.C#NANOS_PER_SECOND . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VideoFrameReleaseTimeHelper.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
private void updateDefaultDisplayRefreshRateParams() {
  // Note: If we fail to update the parameters, we leave them set to their previous values.
  Display defaultDisplay = windowManager.getDefaultDisplay();
  if (defaultDisplay != null) {
    double defaultDisplayRefreshRate = defaultDisplay.getRefreshRate();
    vsyncDurationNs = (long) (C.NANOS_PER_SECOND / defaultDisplayRefreshRate);
    vsyncOffsetNs = (vsyncDurationNs * VSYNC_OFFSET_PERCENTAGE) / 100;
  }
}
 
Example 2
Source File: VideoFrameReleaseTimeHelper.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void updateDefaultDisplayRefreshRateParams() {
  // Note: If we fail to update the parameters, we leave them set to their previous values.
  Display defaultDisplay = windowManager.getDefaultDisplay();
  if (defaultDisplay != null) {
    double defaultDisplayRefreshRate = defaultDisplay.getRefreshRate();
    vsyncDurationNs = (long) (C.NANOS_PER_SECOND / defaultDisplayRefreshRate);
    vsyncOffsetNs = (vsyncDurationNs * VSYNC_OFFSET_PERCENTAGE) / 100;
  }
}
 
Example 3
Source File: VideoFrameReleaseTimeHelper.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void updateDefaultDisplayRefreshRateParams() {
  // Note: If we fail to update the parameters, we leave them set to their previous values.
  Display defaultDisplay = windowManager.getDefaultDisplay();
  if (defaultDisplay != null) {
    double defaultDisplayRefreshRate = defaultDisplay.getRefreshRate();
    vsyncDurationNs = (long) (C.NANOS_PER_SECOND / defaultDisplayRefreshRate);
    vsyncOffsetNs = (vsyncDurationNs * VSYNC_OFFSET_PERCENTAGE) / 100;
  }
}
 
Example 4
Source File: VideoFrameReleaseTimeHelper.java    From K-Sonic with MIT License 5 votes vote down vote up
private VideoFrameReleaseTimeHelper(double defaultDisplayRefreshRate,
    boolean useDefaultDisplayVsync) {
  this.useDefaultDisplayVsync = useDefaultDisplayVsync;
  if (useDefaultDisplayVsync) {
    vsyncSampler = VSyncSampler.getInstance();
    vsyncDurationNs = (long) (C.NANOS_PER_SECOND / defaultDisplayRefreshRate);
    vsyncOffsetNs = (vsyncDurationNs * VSYNC_OFFSET_PERCENTAGE) / 100;
  } else {
    vsyncSampler = null;
    vsyncDurationNs = -1; // Value unused.
    vsyncOffsetNs = -1; // Value unused.
  }
}
 
Example 5
Source File: VideoFrameReleaseTimeHelper.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void updateDefaultDisplayRefreshRateParams() {
  // Note: If we fail to update the parameters, we leave them set to their previous values.
  Display defaultDisplay = windowManager.getDefaultDisplay();
  if (defaultDisplay != null) {
    double defaultDisplayRefreshRate = defaultDisplay.getRefreshRate();
    vsyncDurationNs = (long) (C.NANOS_PER_SECOND / defaultDisplayRefreshRate);
    vsyncOffsetNs = (vsyncDurationNs * VSYNC_OFFSET_PERCENTAGE) / 100;
  }
}
 
Example 6
Source File: VideoFrameReleaseTimeHelper.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void updateDefaultDisplayRefreshRateParams() {
  // Note: If we fail to update the parameters, we leave them set to their previous values.
  Display defaultDisplay = windowManager.getDefaultDisplay();
  if (defaultDisplay != null) {
    double defaultDisplayRefreshRate = defaultDisplay.getRefreshRate();
    vsyncDurationNs = (long) (C.NANOS_PER_SECOND / defaultDisplayRefreshRate);
    vsyncOffsetNs = (vsyncDurationNs * VSYNC_OFFSET_PERCENTAGE) / 100;
  }
}
 
Example 7
Source File: OpusReader.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
private void putNativeOrderLong(List<byte[]> initializationData, int samples) {
  long ns = (samples * C.NANOS_PER_SECOND) / SAMPLE_RATE;
  byte[] array = ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(ns).array();
  initializationData.add(array);
}
 
Example 8
Source File: OpusReader.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
private void putNativeOrderLong(List<byte[]> initializationData, int samples) {
  long ns = (samples * C.NANOS_PER_SECOND) / SAMPLE_RATE;
  byte[] array = ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(ns).array();
  initializationData.add(array);
}
 
Example 9
Source File: OpusReader.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
private void putNativeOrderLong(List<byte[]> initializationData, int samples) {
  long ns = (samples * C.NANOS_PER_SECOND) / SAMPLE_RATE;
  byte[] array = ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(ns).array();
  initializationData.add(array);
}
 
Example 10
Source File: OpusReader.java    From K-Sonic with MIT License 4 votes vote down vote up
private void putNativeOrderLong(List<byte[]> initializationData, int samples) {
  long ns = (samples * C.NANOS_PER_SECOND) / SAMPLE_RATE;
  byte[] array = ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(ns).array();
  initializationData.add(array);
}
 
Example 11
Source File: OpusReader.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
private void putNativeOrderLong(List<byte[]> initializationData, int samples) {
  long ns = (samples * C.NANOS_PER_SECOND) / SAMPLE_RATE;
  byte[] array = ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(ns).array();
  initializationData.add(array);
}
 
Example 12
Source File: OpusReader.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
private void putNativeOrderLong(List<byte[]> initializationData, int samples) {
  long ns = (samples * C.NANOS_PER_SECOND) / SAMPLE_RATE;
  byte[] array = ByteBuffer.allocate(8).order(ByteOrder.nativeOrder()).putLong(ns).array();
  initializationData.add(array);
}