Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3dee8e49
authored
Dec 14, 2021
by
Ian Baker
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge pull request #9767 from TiVo:p-nearest-sync-track-index-bug
PiperOrigin-RevId: 416289790
parents
27b52bca
7ac24528
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsChunkSource.java
library/hls/src/test/java/com/google/android/exoplayer2/source/hls/HlsChunkSourceTest.java
library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsChunkSource.java
View file @
3dee8e49
...
@@ -255,7 +255,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
...
@@ -255,7 +255,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
HlsMediaPlaylist
mediaPlaylist
=
HlsMediaPlaylist
mediaPlaylist
=
selectedIndex
<
playlistUrls
.
length
&&
selectedIndex
!=
C
.
INDEX_UNSET
selectedIndex
<
playlistUrls
.
length
&&
selectedIndex
!=
C
.
INDEX_UNSET
?
playlistTracker
.
getPlaylistSnapshot
(
?
playlistTracker
.
getPlaylistSnapshot
(
playlistUrls
[
selectedIndex
],
/* isForPlayback= */
true
)
playlistUrls
[
trackSelection
.
getSelectedIndexInTrackGroup
()],
/* isForPlayback= */
true
)
:
null
;
:
null
;
if
(
mediaPlaylist
==
null
if
(
mediaPlaylist
==
null
...
...
library/hls/src/test/java/com/google/android/exoplayer2/source/hls/HlsChunkSourceTest.java
View file @
3dee8e49
...
@@ -23,6 +23,7 @@ import static org.mockito.Mockito.when;
...
@@ -23,6 +23,7 @@ import static org.mockito.Mockito.when;
import
android.net.Uri
;
import
android.net.Uri
;
import
androidx.test.core.app.ApplicationProvider
;
import
androidx.test.core.app.ApplicationProvider
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.Format
;
import
com.google.android.exoplayer2.SeekParameters
;
import
com.google.android.exoplayer2.SeekParameters
;
import
com.google.android.exoplayer2.analytics.PlayerId
;
import
com.google.android.exoplayer2.analytics.PlayerId
;
...
@@ -32,6 +33,7 @@ import com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistTracker;
...
@@ -32,6 +33,7 @@ import com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistTracker;
import
com.google.android.exoplayer2.testutil.ExoPlayerTestRunner
;
import
com.google.android.exoplayer2.testutil.ExoPlayerTestRunner
;
import
com.google.android.exoplayer2.testutil.FakeDataSource
;
import
com.google.android.exoplayer2.testutil.FakeDataSource
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.util.MimeTypes
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
org.junit.Before
;
import
org.junit.Before
;
...
@@ -50,8 +52,15 @@ public class HlsChunkSourceTest {
...
@@ -50,8 +52,15 @@ public class HlsChunkSourceTest {
private
static
final
String
PLAYLIST_EMPTY
=
"media/m3u8/media_playlist_empty"
;
private
static
final
String
PLAYLIST_EMPTY
=
"media/m3u8/media_playlist_empty"
;
private
static
final
Uri
PLAYLIST_URI
=
Uri
.
parse
(
"http://example.com/"
);
private
static
final
Uri
PLAYLIST_URI
=
Uri
.
parse
(
"http://example.com/"
);
private
static
final
long
PLAYLIST_START_PERIOD_OFFSET_US
=
8_000_000L
;
private
static
final
long
PLAYLIST_START_PERIOD_OFFSET_US
=
8_000_000L
;
private
static
final
Uri
IFRAME_URI
=
Uri
.
parse
(
"http://example.com/iframe"
);
private
final
HlsExtractorFactory
mockExtractorFactory
=
HlsExtractorFactory
.
DEFAULT
;
private
static
final
Format
IFRAME_FORMAT
=
new
Format
.
Builder
()
.
setSampleMimeType
(
MimeTypes
.
VIDEO_H264
)
.
setAverageBitrate
(
30_000
)
.
setWidth
(
1280
)
.
setHeight
(
720
)
.
setRoleFlags
(
C
.
ROLE_FLAG_TRICK_PLAY
)
.
build
();
@Mock
private
HlsPlaylistTracker
mockPlaylistTracker
;
@Mock
private
HlsPlaylistTracker
mockPlaylistTracker
;
private
HlsChunkSource
testChunkSource
;
private
HlsChunkSource
testChunkSource
;
...
@@ -70,10 +79,10 @@ public class HlsChunkSourceTest {
...
@@ -70,10 +79,10 @@ public class HlsChunkSourceTest {
testChunkSource
=
testChunkSource
=
new
HlsChunkSource
(
new
HlsChunkSource
(
mockExtractorFactory
,
HlsExtractorFactory
.
DEFAULT
,
mockPlaylistTracker
,
mockPlaylistTracker
,
new
Uri
[]
{
PLAYLIST_URI
},
new
Uri
[]
{
IFRAME_URI
,
PLAYLIST_URI
},
new
Format
[]
{
ExoPlayerTestRunner
.
VIDEO_FORMAT
},
new
Format
[]
{
IFRAME_FORMAT
,
ExoPlayerTestRunner
.
VIDEO_FORMAT
},
new
DefaultHlsDataSourceFactory
(
new
FakeDataSource
.
Factory
()),
new
DefaultHlsDataSourceFactory
(
new
FakeDataSource
.
Factory
()),
/* mediaTransferListener= */
null
,
/* mediaTransferListener= */
null
,
new
TimestampAdjusterProvider
(),
new
TimestampAdjusterProvider
(),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment