Skip to content

Commit

Permalink
issue google#4352 resolved using handler on handling messsages
Browse files Browse the repository at this point in the history
  • Loading branch information
kashu1209 committed Jan 30, 2020
1 parent ea342a6 commit 6281f23
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1466,12 +1466,14 @@ private void setVideoSurfaceInternal(@Nullable Surface surface, boolean ownsSurf
}
if (this.surface != null && this.surface != surface) {
// We're replacing a surface. Block to ensure that it's not accessed after the method returns.
try {
for (PlayerMessage message : messages) {
message.blockUntilDelivered();
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
for (PlayerMessage message : messages) {
new Handler().post(() -> {
try {
message.blockUntilDelivered();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
});
}
// If we created the previous surface, we are responsible for releasing it.
if (this.ownsSurface) {
Expand Down

0 comments on commit 6281f23

Please sign in to comment.