mirror of
https://github.com/androidx/media.git
synced 2025-05-05 14:40:50 +08:00
Fix ID10T timing error
This commit is contained in:
parent
d2bb0c2cc1
commit
8d9b895f15
@ -152,28 +152,15 @@ public class BitmapFactoryVideoRenderer extends BaseRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class RenderRunnable implements Runnable {
|
class RenderRunnable implements Runnable {
|
||||||
final DecoderInputBuffer decoderInputBuffer;
|
private DecoderInputBuffer decoderInputBuffer;
|
||||||
final long renderUs;
|
private final long renderUs;
|
||||||
|
|
||||||
RenderRunnable(final DecoderInputBuffer decoderInputBuffer, long renderUs) {
|
RenderRunnable(@NonNull final DecoderInputBuffer decoderInputBuffer, long renderUs) {
|
||||||
this.decoderInputBuffer = decoderInputBuffer;
|
this.decoderInputBuffer = decoderInputBuffer;
|
||||||
this.renderUs = renderUs;
|
this.renderUs = renderUs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
synchronized (eventDispatcher) {
|
|
||||||
while (currentTimeUs < renderUs) {
|
|
||||||
try {
|
|
||||||
thread = Thread.currentThread();
|
|
||||||
eventDispatcher.wait();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
//If we are interrupted, treat as a cancel
|
|
||||||
return;
|
|
||||||
} finally {
|
|
||||||
thread = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Nullable
|
@Nullable
|
||||||
final ByteBuffer byteBuffer = decoderInputBuffer.data;
|
final ByteBuffer byteBuffer = decoderInputBuffer.data;
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -190,6 +177,21 @@ public class BitmapFactoryVideoRenderer extends BaseRenderer {
|
|||||||
eventDispatcher.videoCodecError(new NullPointerException("Decode bytes failed"));
|
eventDispatcher.videoCodecError(new NullPointerException("Decode bytes failed"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
decoderInputBuffer = null;
|
||||||
|
//Wait for time to advance to display the Bitmap
|
||||||
|
synchronized (eventDispatcher) {
|
||||||
|
while (currentTimeUs < renderUs) {
|
||||||
|
try {
|
||||||
|
thread = Thread.currentThread();
|
||||||
|
eventDispatcher.wait();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
//If we are interrupted, treat as a cancel
|
||||||
|
return;
|
||||||
|
} finally {
|
||||||
|
thread = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//Log.d(TAG, "Drawing: " + bitmap.getWidth() + "x" + bitmap.getHeight());
|
//Log.d(TAG, "Drawing: " + bitmap.getWidth() + "x" + bitmap.getHeight());
|
||||||
final Canvas canvas = surface.lockCanvas(null);
|
final Canvas canvas = surface.lockCanvas(null);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user