public synchronized void blockingSendMessage(ExoPlayerComponent target, int messageType, Object message) { if (released) { Log.w(TAG, "Sent message(" + messageType + ") after release. Message ignored."); return; } int messageNumber = customMessagesSent++; handler.obtainMessage(MSG_CUSTOM, messageType, 0, Pair.create(target, message)).sendToTarget(); while (customMessagesProcessed <= messageNumber) { try { wait(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }
private <T> void sendMessageInternal(int what, Object obj) throws ExoPlaybackException { try { @SuppressWarnings("unchecked") Pair<ExoPlayerComponent, Object> targetAndMessage = (Pair<ExoPlayerComponent, Object>) obj; targetAndMessage.first.handleMessage(what, targetAndMessage.second); } finally { synchronized (this) { customMessagesProcessed++; notifyAll(); } } if (state != ExoPlayer.STATE_IDLE && state != ExoPlayer.STATE_PREPARING) { // The message may have caused something to change that now requires us to do work. handler.sendEmptyMessage(MSG_DO_SOME_WORK); } }
private <T> void sendMessageInternal(int what, Object obj) throws ExoPlaybackException { try { @SuppressWarnings("unchecked") Pair<ExoPlayerComponent, Object> targetAndMessage = (Pair<ExoPlayerComponent, Object>) obj; targetAndMessage.first.handleMessage(what, targetAndMessage.second); if (state != ExoPlayer.STATE_IDLE && state != ExoPlayer.STATE_PREPARING) { // The message may have caused something to change that now requires us to do work. handler.sendEmptyMessage(MSG_DO_SOME_WORK); } } finally { synchronized (this) { customMessagesProcessed++; notifyAll(); } } }
private <T> void sendMessageInternal(int what, Object obj) throws ExoPlaybackException { try { @SuppressWarnings("unchecked") Pair<ExoPlayerComponent, Object> targetAndMessage = (Pair<ExoPlayerComponent, Object>) obj; targetAndMessage.first.handleMessage(what, targetAndMessage.second); } finally { synchronized (this) { customMessagesProcessed++; notifyAll(); } } if (state != ExoPlayer.STATE_IDLE && state != ExoPlayer.STATE_PREPARING) { System.out.println("ExoPlayerImplInternal.sendMessageInternal() send MSG_DO_SOME_WORK ***"); // The message may have caused something to change that now requires us to do work. handler.sendEmptyMessage(MSG_DO_SOME_WORK); } }
public synchronized void blockingSendMessage(ExoPlayerComponent target, int messageType, Object message) { int messageNumber = customMessagesSent++; handler.obtainMessage(MSG_CUSTOM, messageType, 0, Pair.create(target, message)).sendToTarget(); while (customMessagesProcessed <= messageNumber) { try { wait(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }
public void sendMessage(ExoPlayerComponent target, int messageType, Object message) { customMessagesSent++; handler.obtainMessage(MSG_CUSTOM, messageType, 0, Pair.create(target, message)).sendToTarget(); }