Skip to content

Commit 3e2ee25

Browse files
clainclycopybara-github
authored andcommitted
Log the presentation time when throwing an error
PiperOrigin-RevId: 786683659
1 parent abfd494 commit 3e2ee25

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

libraries/common/src/main/java/androidx/media3/common/VideoFrameProcessingException.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public VideoFrameProcessingException(String message) {
6767
* @param presentationTimeUs The timestamp of the frame for which the exception occurred.
6868
*/
6969
public VideoFrameProcessingException(String message, long presentationTimeUs) {
70-
super(message);
70+
super(message + getPresentationTimeUsString(presentationTimeUs));
7171
this.presentationTimeUs = presentationTimeUs;
7272
}
7373

@@ -89,7 +89,7 @@ public VideoFrameProcessingException(String message, Throwable cause) {
8989
* @param presentationTimeUs The timestamp of the frame for which the exception occurred.
9090
*/
9191
public VideoFrameProcessingException(String message, Throwable cause, long presentationTimeUs) {
92-
super(message, cause);
92+
super(message + getPresentationTimeUsString(presentationTimeUs), cause);
9393
this.presentationTimeUs = presentationTimeUs;
9494
}
9595

@@ -109,7 +109,11 @@ public VideoFrameProcessingException(Throwable cause) {
109109
* @param presentationTimeUs The timestamp of the frame for which the exception occurred.
110110
*/
111111
public VideoFrameProcessingException(Throwable cause, long presentationTimeUs) {
112-
super(cause);
112+
super(getPresentationTimeUsString(presentationTimeUs), cause);
113113
this.presentationTimeUs = presentationTimeUs;
114114
}
115+
116+
private static String getPresentationTimeUsString(long presentationTimeUs) {
117+
return presentationTimeUs == C.TIME_UNSET ? " @UNSET" : " @" + presentationTimeUs;
118+
}
115119
}

0 commit comments

Comments
 (0)