com.google.android.exoplayer2.source.chunk.ChunkSampleStream.EmbeddedSampleStream Java Examples

The following examples show how to use com.google.android.exoplayer2.source.chunk.ChunkSampleStream.EmbeddedSampleStream. 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: DashMediaPeriod.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private void releaseDisabledStreams(
    TrackSelection[] selections, boolean[] mayRetainStreamFlags, SampleStream[] streams) {
  for (int i = 0; i < selections.length; i++) {
    if (selections[i] == null || !mayRetainStreamFlags[i]) {
      if (streams[i] instanceof ChunkSampleStream) {
        @SuppressWarnings("unchecked")
        ChunkSampleStream<DashChunkSource> stream =
            (ChunkSampleStream<DashChunkSource>) streams[i];
        stream.release(this);
      } else if (streams[i] instanceof EmbeddedSampleStream) {
        ((EmbeddedSampleStream) streams[i]).release();
      }
      streams[i] = null;
    }
  }
}
 
Example #2
Source File: DashMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void releaseDisabledStreams(
    TrackSelection[] selections, boolean[] mayRetainStreamFlags, SampleStream[] streams) {
  for (int i = 0; i < selections.length; i++) {
    if (selections[i] == null || !mayRetainStreamFlags[i]) {
      if (streams[i] instanceof ChunkSampleStream) {
        @SuppressWarnings("unchecked")
        ChunkSampleStream<DashChunkSource> stream =
            (ChunkSampleStream<DashChunkSource>) streams[i];
        stream.release(this);
      } else if (streams[i] instanceof EmbeddedSampleStream) {
        ((EmbeddedSampleStream) streams[i]).release();
      }
      streams[i] = null;
    }
  }
}
 
Example #3
Source File: DashMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void releaseDisabledStreams(
    TrackSelection[] selections, boolean[] mayRetainStreamFlags, SampleStream[] streams) {
  for (int i = 0; i < selections.length; i++) {
    if (selections[i] == null || !mayRetainStreamFlags[i]) {
      if (streams[i] instanceof ChunkSampleStream) {
        @SuppressWarnings("unchecked")
        ChunkSampleStream<DashChunkSource> stream =
            (ChunkSampleStream<DashChunkSource>) streams[i];
        stream.release(this);
      } else if (streams[i] instanceof EmbeddedSampleStream) {
        ((EmbeddedSampleStream) streams[i]).release();
      }
      streams[i] = null;
    }
  }
}
 
Example #4
Source File: DashMediaPeriod.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private void releaseDisabledStreams(
    TrackSelection[] selections, boolean[] mayRetainStreamFlags, SampleStream[] streams) {
  for (int i = 0; i < selections.length; i++) {
    if (selections[i] == null || !mayRetainStreamFlags[i]) {
      if (streams[i] instanceof ChunkSampleStream) {
        @SuppressWarnings("unchecked")
        ChunkSampleStream<DashChunkSource> stream =
            (ChunkSampleStream<DashChunkSource>) streams[i];
        stream.release(this);
      } else if (streams[i] instanceof EmbeddedSampleStream) {
        ((EmbeddedSampleStream) streams[i]).release();
      }
      streams[i] = null;
    }
  }
}
 
Example #5
Source File: DashMediaPeriod.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private void releaseDisabledStreams(
    TrackSelection[] selections, boolean[] mayRetainStreamFlags, SampleStream[] streams) {
  for (int i = 0; i < selections.length; i++) {
    if (selections[i] == null || !mayRetainStreamFlags[i]) {
      if (streams[i] instanceof ChunkSampleStream) {
        @SuppressWarnings("unchecked")
        ChunkSampleStream<DashChunkSource> stream =
            (ChunkSampleStream<DashChunkSource>) streams[i];
        stream.release(this);
      } else if (streams[i] instanceof EmbeddedSampleStream) {
        ((EmbeddedSampleStream) streams[i]).release();
      }
      streams[i] = null;
    }
  }
}
 
Example #6
Source File: DashMediaPeriod.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
private void releaseOrphanEmbeddedStreams(
    TrackSelection[] selections, SampleStream[] streams, int[] streamIndexToTrackGroupIndex) {
  for (int i = 0; i < selections.length; i++) {
    if (streams[i] instanceof EmptySampleStream || streams[i] instanceof EmbeddedSampleStream) {
      // We need to release an embedded stream if the corresponding primary stream is released.
      int primaryStreamIndex = getPrimaryStreamIndex(i, streamIndexToTrackGroupIndex);
      boolean mayRetainStream;
      if (primaryStreamIndex == C.INDEX_UNSET) {
        // If the corresponding primary stream is not selected, we may retain an existing
        // EmptySampleStream.
        mayRetainStream = streams[i] instanceof EmptySampleStream;
      } else {
        // If the corresponding primary stream is selected, we may retain the embedded stream if
        // the stream's parent still matches.
        mayRetainStream =
            (streams[i] instanceof EmbeddedSampleStream)
                && ((EmbeddedSampleStream) streams[i]).parent == streams[primaryStreamIndex];
      }
      if (!mayRetainStream) {
        if (streams[i] instanceof EmbeddedSampleStream) {
          ((EmbeddedSampleStream) streams[i]).release();
        }
        streams[i] = null;
      }
    }
  }
}
 
Example #7
Source File: DashMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void releaseOrphanEmbeddedStreams(
    TrackSelection[] selections, SampleStream[] streams, int[] streamIndexToTrackGroupIndex) {
  for (int i = 0; i < selections.length; i++) {
    if (streams[i] instanceof EmptySampleStream || streams[i] instanceof EmbeddedSampleStream) {
      // We need to release an embedded stream if the corresponding primary stream is released.
      int primaryStreamIndex = getPrimaryStreamIndex(i, streamIndexToTrackGroupIndex);
      boolean mayRetainStream;
      if (primaryStreamIndex == C.INDEX_UNSET) {
        // If the corresponding primary stream is not selected, we may retain an existing
        // EmptySampleStream.
        mayRetainStream = streams[i] instanceof EmptySampleStream;
      } else {
        // If the corresponding primary stream is selected, we may retain the embedded stream if
        // the stream's parent still matches.
        mayRetainStream =
            (streams[i] instanceof EmbeddedSampleStream)
                && ((EmbeddedSampleStream) streams[i]).parent == streams[primaryStreamIndex];
      }
      if (!mayRetainStream) {
        if (streams[i] instanceof EmbeddedSampleStream) {
          ((EmbeddedSampleStream) streams[i]).release();
        }
        streams[i] = null;
      }
    }
  }
}
 
Example #8
Source File: DashMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void releaseOrphanEmbeddedStreams(
    TrackSelection[] selections, SampleStream[] streams, int[] streamIndexToTrackGroupIndex) {
  for (int i = 0; i < selections.length; i++) {
    if (streams[i] instanceof EmptySampleStream || streams[i] instanceof EmbeddedSampleStream) {
      // We need to release an embedded stream if the corresponding primary stream is released.
      int primaryStreamIndex = getPrimaryStreamIndex(i, streamIndexToTrackGroupIndex);
      boolean mayRetainStream;
      if (primaryStreamIndex == C.INDEX_UNSET) {
        // If the corresponding primary stream is not selected, we may retain an existing
        // EmptySampleStream.
        mayRetainStream = streams[i] instanceof EmptySampleStream;
      } else {
        // If the corresponding primary stream is selected, we may retain the embedded stream if
        // the stream's parent still matches.
        mayRetainStream =
            (streams[i] instanceof EmbeddedSampleStream)
                && ((EmbeddedSampleStream) streams[i]).parent == streams[primaryStreamIndex];
      }
      if (!mayRetainStream) {
        if (streams[i] instanceof EmbeddedSampleStream) {
          ((EmbeddedSampleStream) streams[i]).release();
        }
        streams[i] = null;
      }
    }
  }
}
 
Example #9
Source File: DashMediaPeriod.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void releaseOrphanEmbeddedStreams(
    TrackSelection[] selections, SampleStream[] streams, int[] streamIndexToTrackGroupIndex) {
  for (int i = 0; i < selections.length; i++) {
    if (streams[i] instanceof EmptySampleStream || streams[i] instanceof EmbeddedSampleStream) {
      // We need to release an embedded stream if the corresponding primary stream is released.
      int primaryStreamIndex = getPrimaryStreamIndex(i, streamIndexToTrackGroupIndex);
      boolean mayRetainStream;
      if (primaryStreamIndex == C.INDEX_UNSET) {
        // If the corresponding primary stream is not selected, we may retain an existing
        // EmptySampleStream.
        mayRetainStream = streams[i] instanceof EmptySampleStream;
      } else {
        // If the corresponding primary stream is selected, we may retain the embedded stream if
        // the stream's parent still matches.
        mayRetainStream =
            (streams[i] instanceof EmbeddedSampleStream)
                && ((EmbeddedSampleStream) streams[i]).parent == streams[primaryStreamIndex];
      }
      if (!mayRetainStream) {
        if (streams[i] instanceof EmbeddedSampleStream) {
          ((EmbeddedSampleStream) streams[i]).release();
        }
        streams[i] = null;
      }
    }
  }
}
 
Example #10
Source File: DashMediaPeriod.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void releaseOrphanEmbeddedStreams(
    TrackSelection[] selections, SampleStream[] streams, int[] streamIndexToTrackGroupIndex) {
  for (int i = 0; i < selections.length; i++) {
    if (streams[i] instanceof EmptySampleStream || streams[i] instanceof EmbeddedSampleStream) {
      // We need to release an embedded stream if the corresponding primary stream is released.
      int primaryStreamIndex = getPrimaryStreamIndex(i, streamIndexToTrackGroupIndex);
      boolean mayRetainStream;
      if (primaryStreamIndex == C.INDEX_UNSET) {
        // If the corresponding primary stream is not selected, we may retain an existing
        // EmptySampleStream.
        mayRetainStream = streams[i] instanceof EmptySampleStream;
      } else {
        // If the corresponding primary stream is selected, we may retain the embedded stream if
        // the stream's parent still matches.
        mayRetainStream =
            (streams[i] instanceof EmbeddedSampleStream)
                && ((EmbeddedSampleStream) streams[i]).parent == streams[primaryStreamIndex];
      }
      if (!mayRetainStream) {
        if (streams[i] instanceof EmbeddedSampleStream) {
          ((EmbeddedSampleStream) streams[i]).release();
        }
        streams[i] = null;
      }
    }
  }
}
 
Example #11
Source File: DashMediaPeriod.java    From K-Sonic with MIT License 4 votes vote down vote up
private static void releaseIfEmbeddedSampleStream(SampleStream sampleStream) {
  if (sampleStream instanceof EmbeddedSampleStream) {
    ((EmbeddedSampleStream) sampleStream).release();
  }
}