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
66c1aede
authored
May 18, 2021
by
aquilescanta
Committed by
Oliver Woodman
May 19, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Assign ERROR_CODE_BEHIND_LIVE_WINDOW to BehindLiveWindowExceptions
PiperOrigin-RevId: 374425179
parent
73f28d48
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
10 deletions
library/common/src/main/java/com/google/android/exoplayer2/ExoPlaybackException.java
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java
library/common/src/main/java/com/google/android/exoplayer2/ExoPlaybackException.java
View file @
66c1aede
...
...
@@ -114,7 +114,18 @@ public final class ExoPlaybackException extends PlaybackException {
* @return The created instance.
*/
public
static
ExoPlaybackException
createForSource
(
IOException
cause
)
{
return
new
ExoPlaybackException
(
TYPE_SOURCE
,
cause
,
ERROR_CODE_UNSPECIFIED
);
return
createForSource
(
cause
,
ERROR_CODE_UNSPECIFIED
);
}
/**
* Creates an instance of type {@link #TYPE_SOURCE}.
*
* @param cause The cause of the failure.
* @param errorCode See {@link #errorCode}.
* @return The created instance.
*/
public
static
ExoPlaybackException
createForSource
(
IOException
cause
,
int
errorCode
)
{
return
new
ExoPlaybackException
(
TYPE_SOURCE
,
cause
,
errorCode
);
}
/**
...
...
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java
View file @
66c1aede
...
...
@@ -35,6 +35,7 @@ import com.google.android.exoplayer2.Player.PlaybackSuppressionReason;
import
com.google.android.exoplayer2.Player.RepeatMode
;
import
com.google.android.exoplayer2.analytics.AnalyticsCollector
;
import
com.google.android.exoplayer2.metadata.Metadata
;
import
com.google.android.exoplayer2.source.BehindLiveWindowException
;
import
com.google.android.exoplayer2.source.MediaPeriod
;
import
com.google.android.exoplayer2.source.MediaSource.MediaPeriodId
;
import
com.google.android.exoplayer2.source.SampleStream
;
...
...
@@ -570,16 +571,10 @@ import java.util.concurrent.atomic.AtomicBoolean;
stopInternal
(
/* forceResetRenderers= */
true
,
/* acknowledgeStop= */
false
);
playbackInfo
=
playbackInfo
.
copyWithPlaybackError
(
e
);
}
}
catch
(
BehindLiveWindowException
e
)
{
handleIoException
(
e
,
PlaybackException
.
ERROR_CODE_BEHIND_LIVE_WINDOW
);
}
catch
(
IOException
e
)
{
ExoPlaybackException
error
=
ExoPlaybackException
.
createForSource
(
e
);
@Nullable
MediaPeriodHolder
playingPeriod
=
queue
.
getPlayingPeriod
();
if
(
playingPeriod
!=
null
)
{
// We ensure that all IOException throwing methods are only executed for the playing period.
error
=
error
.
copyWithMediaPeriodId
(
playingPeriod
.
info
.
id
);
}
Log
.
e
(
TAG
,
"Playback error"
,
error
);
stopInternal
(
/* forceResetRenderers= */
false
,
/* acknowledgeStop= */
false
);
playbackInfo
=
playbackInfo
.
copyWithPlaybackError
(
error
);
handleIoException
(
e
,
PlaybackException
.
ERROR_CODE_UNSPECIFIED
);
}
catch
(
RuntimeException
e
)
{
ExoPlaybackException
error
=
ExoPlaybackException
.
createForUnexpected
(
e
);
Log
.
e
(
TAG
,
"Playback error"
,
error
);
...
...
@@ -592,6 +587,18 @@ import java.util.concurrent.atomic.AtomicBoolean;
// Private methods.
private
void
handleIoException
(
IOException
e
,
@PlaybackException
.
ErrorCode
int
errorCode
)
{
ExoPlaybackException
error
=
ExoPlaybackException
.
createForSource
(
e
,
errorCode
);
@Nullable
MediaPeriodHolder
playingPeriod
=
queue
.
getPlayingPeriod
();
if
(
playingPeriod
!=
null
)
{
// We ensure that all IOException throwing methods are only executed for the playing period.
error
=
error
.
copyWithMediaPeriodId
(
playingPeriod
.
info
.
id
);
}
Log
.
e
(
TAG
,
"Playback error"
,
error
);
stopInternal
(
/* forceResetRenderers= */
false
,
/* acknowledgeStop= */
false
);
playbackInfo
=
playbackInfo
.
copyWithPlaybackError
(
error
);
}
/**
* Blocks the current thread until a condition becomes true or the specified amount of time has
* elapsed.
...
...
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