1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-23 03:22:37 +01:00

-[#1383]Fixed popup player caption selector not populating due to full width aspect ratio selector.

-Fixed potential memory leak in media session connector containing player instance.
This commit is contained in:
John Zhen Mo 2018-05-10 17:48:05 -07:00
parent bc6fdf81d2
commit 5c202f04e7
3 changed files with 9 additions and 20 deletions

View File

@ -285,9 +285,11 @@ public abstract class BasePlayer implements
destroyPlayer();
unregisterBroadcastReceiver();
if (mediaSessionManager != null) mediaSessionManager.dispose();
trackSelector = null;
simpleExoPlayer = null;
mediaSessionManager = null;
simpleExoPlayer = null;
}
/*//////////////////////////////////////////////////////////////////////////
@ -494,22 +496,6 @@ public abstract class BasePlayer implements
(manifest == null ? "no manifest" : "available manifest") + ", " +
"timeline size = [" + timeline.getWindowCount() + "], " +
"reason = [" + reason + "]");
if (playQueue == null) return;
switch (reason) {
case Player.TIMELINE_CHANGE_REASON_RESET: // called after #block
case Player.TIMELINE_CHANGE_REASON_PREPARED: // called after #unblock
case Player.TIMELINE_CHANGE_REASON_DYNAMIC: // called after playlist changes
// Ensures MediaSourceManager#update is complete
final boolean isPlaylistStable = timeline.getWindowCount() == playQueue.size();
// Ensure dynamic/livestream timeline changes does not cause negative position
if (isPlaylistStable && !isCurrentWindowValid() && !isSynchronizing) {
if (DEBUG) Log.d(TAG, "Playback - negative time position reached, " +
"clamping to default position.");
seekToDefault();
}
break;
}
}
@Override
@ -598,7 +584,7 @@ public abstract class BasePlayer implements
} else if (isSynchronizing && isLive()) {
// Is still synchronizing?
if (DEBUG) Log.d(TAG, "Playback - Synchronizing livestream to default time");
seekToDefault();
//seekToDefault();
} else if (isSynchronizing && presetStartPositionMillis > 0L) {
// Has another start position?

View File

@ -39,10 +39,13 @@ public class MediaSessionManager {
return MediaButtonReceiver.handleIntent(mediaSession, intent);
}
/**
* Should be called on player destruction to prevent leakage.
* */
public void dispose() {
this.sessionConnector.setPlayer(null, null);
this.sessionConnector.setQueueNavigator(null);
this.mediaSession.setActive(false);
this.mediaSession.release();
}
}
}

View File

@ -111,7 +111,7 @@
<TextView
android:id="@+id/resizeTextView"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:background="?attr/selectableItemBackground"