mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
PlaybackVideoGraphWrapper: update listener logic for multi sequence
- Only have the primary sequence renderers listen to PlaybackVideoGraphWrapper events. These events only need to be forwarded to a single ExoPlayer instance. - Set the DefaultVideoSinkListener only once. PiperOrigin-RevId: 742636455
This commit is contained in:
parent
595b75b7d3
commit
f2d644b7b4
@ -368,7 +368,9 @@ public final class PlaybackVideoGraphWrapper implements VideoSinkProvider, Video
|
|||||||
public VideoSink getSink(int inputIndex) {
|
public VideoSink getSink(int inputIndex) {
|
||||||
checkState(!contains(inputVideoSinks, inputIndex));
|
checkState(!contains(inputVideoSinks, inputIndex));
|
||||||
InputVideoSink inputVideoSink = new InputVideoSink(context, inputIndex);
|
InputVideoSink inputVideoSink = new InputVideoSink(context, inputIndex);
|
||||||
|
if (inputIndex == PRIMARY_SEQUENCE_INDEX) {
|
||||||
addListener(inputVideoSink);
|
addListener(inputVideoSink);
|
||||||
|
}
|
||||||
inputVideoSinks.put(inputIndex, inputVideoSink);
|
inputVideoSinks.put(inputIndex, inputVideoSink);
|
||||||
return inputVideoSink;
|
return inputVideoSink;
|
||||||
}
|
}
|
||||||
@ -536,6 +538,7 @@ public final class PlaybackVideoGraphWrapper implements VideoSinkProvider, Video
|
|||||||
maybeSetOutputSurfaceInfo(surface, size.getWidth(), size.getHeight());
|
maybeSetOutputSurfaceInfo(surface, size.getWidth(), size.getHeight());
|
||||||
}
|
}
|
||||||
defaultVideoSink.initialize(sourceFormat);
|
defaultVideoSink.initialize(sourceFormat);
|
||||||
|
defaultVideoSink.setListener(new DefaultVideoSinkListener(), /* executor= */ handler::post);
|
||||||
state = STATE_INITIALIZED;
|
state = STATE_INITIALIZED;
|
||||||
} else {
|
} else {
|
||||||
if (!isInitialized()) {
|
if (!isInitialized()) {
|
||||||
@ -550,8 +553,6 @@ public final class PlaybackVideoGraphWrapper implements VideoSinkProvider, Video
|
|||||||
throw new VideoSink.VideoSinkException(e, sourceFormat);
|
throw new VideoSink.VideoSinkException(e, sourceFormat);
|
||||||
}
|
}
|
||||||
registeredVideoInputCount++;
|
registeredVideoInputCount++;
|
||||||
defaultVideoSink.setListener(
|
|
||||||
new DefaultVideoSinkListener(), /* executor= */ checkNotNull(handler)::post);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user