-Fixed media source manager sync identical item multiple times, causing OOM.

-Removed deprecated translated leak canary string from other languages.
This commit is contained in:
John Zhen Mo 2018-02-18 00:26:53 -08:00
parent e21d2bd511
commit 762f374f93
7 changed files with 12 additions and 15 deletions

View file

@ -105,6 +105,7 @@ public class MediaSourceManager {
playQueueReactor = null; playQueueReactor = null;
syncReactor = null; syncReactor = null;
syncedItem = null;
sources = null; sources = null;
} }
@ -124,6 +125,8 @@ public class MediaSourceManager {
* */ * */
public void reset() { public void reset() {
tryBlock(); tryBlock();
syncedItem = null;
populateSources(); populateSources();
} }
/*////////////////////////////////////////////////////////////////////////// /*//////////////////////////////////////////////////////////////////////////
@ -243,20 +246,20 @@ public class MediaSourceManager {
syncInternal(currentItem, null); syncInternal(currentItem, null);
}; };
final Disposable sync = currentItem.getStream() if (syncedItem != currentItem) {
.observeOn(AndroidSchedulers.mainThread()) syncedItem = currentItem;
.subscribe(onSuccess, onError); final Disposable sync = currentItem.getStream()
syncReactor.add(sync); .observeOn(AndroidSchedulers.mainThread())
.subscribe(onSuccess, onError);
syncReactor.add(sync);
}
} }
private void syncInternal(@android.support.annotation.NonNull final PlayQueueItem item, private void syncInternal(@android.support.annotation.NonNull final PlayQueueItem item,
@Nullable final StreamInfo info) { @Nullable final StreamInfo info) {
if (playQueue == null || playbackListener == null) return; if (playQueue == null || playbackListener == null) return;
// Ensure the current item is up to date with the play queue
// Sync each new item once only and ensure the current item is up to date if (playQueue.getItem() == item && playQueue.getItem() == syncedItem) {
// with the play queue
if (playQueue.getItem() != syncedItem && playQueue.getItem() == item) {
syncedItem = item;
playbackListener.sync(syncedItem,info); playbackListener.sync(syncedItem,info);
} }
} }

View file

@ -373,5 +373,4 @@
<string name="caption_none">Keine Untertitel</string> <string name="caption_none">Keine Untertitel</string>
<string name="caption_font_size_settings_title">Schriftgröße der Untertitel</string> <string name="caption_font_size_settings_title">Schriftgröße der Untertitel</string>
<string name="toggle_leak_canary">"Speicherlecks nachverfolgen "</string>
</resources> </resources>

View file

@ -395,7 +395,6 @@
<string name="normal_caption_font_size">Carattere normale</string> <string name="normal_caption_font_size">Carattere normale</string>
<string name="larger_caption_font_size">Carattere più grande</string> <string name="larger_caption_font_size">Carattere più grande</string>
<string name="toggle_leak_canary">Controllo delle perdite</string>
<string name="enable_leak_canary_notice">Controllo delle perdite di memoria abilitato, l\'applicazione può non rispondere mentre effettua il dumping dell\'heap</string> <string name="enable_leak_canary_notice">Controllo delle perdite di memoria abilitato, l\'applicazione può non rispondere mentre effettua il dumping dell\'heap</string>
<string name="disable_leak_canary_notice">Controllo delle perdite di memoria disabilitato</string> <string name="disable_leak_canary_notice">Controllo delle perdite di memoria disabilitato</string>
<string name="drawer_header_action_paceholder_text">A breve qualcosa si troverà qui ;D</string> <string name="drawer_header_action_paceholder_text">A breve qualcosa si troverà qui ;D</string>

View file

@ -383,7 +383,6 @@
<string name="normal_caption_font_size">Normal skrift</string> <string name="normal_caption_font_size">Normal skrift</string>
<string name="larger_caption_font_size">Større skrift</string> <string name="larger_caption_font_size">Større skrift</string>
<string name="toggle_leak_canary">Hold oppsyn med lekkasjer</string>
<string name="enable_leak_canary_notice">Oppsyn med minnelekasjer påslått, programmet kan slutte å svare under haug-dumping</string> <string name="enable_leak_canary_notice">Oppsyn med minnelekasjer påslått, programmet kan slutte å svare under haug-dumping</string>
<string name="disable_leak_canary_notice">Oppsyn med minnelekasjer slått av</string> <string name="disable_leak_canary_notice">Oppsyn med minnelekasjer slått av</string>
</resources> </resources>

View file

@ -391,7 +391,6 @@ te openen in pop-upmodus</string>
<string name="normal_caption_font_size">Normaal lettertype</string> <string name="normal_caption_font_size">Normaal lettertype</string>
<string name="larger_caption_font_size">Groter lettertype</string> <string name="larger_caption_font_size">Groter lettertype</string>
<string name="toggle_leak_canary">Controleren op lekken</string>
<string name="enable_leak_canary_notice">Controleren op geheugenlekken ingeschakeld, tijdens heapdumping kan de app tijdelijk niet reageren</string> <string name="enable_leak_canary_notice">Controleren op geheugenlekken ingeschakeld, tijdens heapdumping kan de app tijdelijk niet reageren</string>
<string name="disable_leak_canary_notice">Controleren op geheugenlekken uitgeschakeld</string> <string name="disable_leak_canary_notice">Controleren op geheugenlekken uitgeschakeld</string>
<string name="drawer_header_action_paceholder_text">Hier zal binnenkort iets verschijnen ;D</string> <string name="drawer_header_action_paceholder_text">Hier zal binnenkort iets verschijnen ;D</string>

View file

@ -369,7 +369,6 @@ abrir em modo popup</string>
<string name="normal_caption_font_size">Fonte normal</string> <string name="normal_caption_font_size">Fonte normal</string>
<string name="larger_caption_font_size">Maior fonte</string> <string name="larger_caption_font_size">Maior fonte</string>
<string name="toggle_leak_canary">Monitorar vazamentos de memória</string>
<string name="enable_leak_canary_notice">Monitoramento de vazamentos de memória habilitado, o aplicativo pode ficar sem responder quando estiver descarregando pilha de memória</string> <string name="enable_leak_canary_notice">Monitoramento de vazamentos de memória habilitado, o aplicativo pode ficar sem responder quando estiver descarregando pilha de memória</string>
<string name="disable_leak_canary_notice">Monitoramento de vazamentos de memória desabilitado</string> <string name="disable_leak_canary_notice">Monitoramento de vazamentos de memória desabilitado</string>
</resources> </resources>

View file

@ -385,7 +385,6 @@
<string name="normal_caption_font_size">Olağan Yazı Tipi</string> <string name="normal_caption_font_size">Olağan Yazı Tipi</string>
<string name="larger_caption_font_size">Büyük Yazı Tipi</string> <string name="larger_caption_font_size">Büyük Yazı Tipi</string>
<string name="toggle_leak_canary">Sızıntıları Gözlemle</string>
<string name="enable_leak_canary_notice">Bellek sızıntısı gözlemleme etkinleştirildi, uygulama yığın atımı sırasında yanıtsız kalabilir</string> <string name="enable_leak_canary_notice">Bellek sızıntısı gözlemleme etkinleştirildi, uygulama yığın atımı sırasında yanıtsız kalabilir</string>
<string name="disable_leak_canary_notice">Bellek sızıntısı gözlemleme devre dışı</string> <string name="disable_leak_canary_notice">Bellek sızıntısı gözlemleme devre dışı</string>
</resources> </resources>