Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03f94352 authored by Glenn Kasten's avatar Glenn Kasten Committed by Android (Google) Code Review
Browse files

Merge "Bug 4571308 Provide correct video frame timestamps"

parents 02cc72c1 5c2faf3d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -174,12 +174,15 @@ public class SurfaceTexture {
     * Retrieve the timestamp associated with the texture image set by the most recent call to
     * updateTexImage.
     *
     * This timestamp is in nanoseconds, and is guaranteed to be monotonically increasing. The
     * This timestamp is in nanoseconds, and is normally monotonically increasing. The timestamp
     * should be unaffected by time-of-day adjustments, and for a camera should be strictly
     * monotonic but for a MediaPlayer may be reset when the position is set.  The
     * specific meaning and zero point of the timestamp depends on the source providing images to
     * the SurfaceTexture. Unless otherwise specified by the image source, timestamps cannot
     * generally be compared across SurfaceTexture instances, or across multiple program
     * invocations. It is mostly useful for determining time offsets between subsequent frames.
     */

    public long getTimestamp() {
        return nativeGetTimestamp();
    }
+4 −7
Original line number Diff line number Diff line
@@ -611,15 +611,11 @@ public class MediaPlayer
     * needed.  Not calling this method when playing back a video will
     * result in only the audio track being played.
     *
     * @param sh the SurfaceHolder to use for video display
     */
    /*
     * This portion of comment has a non-Javadoc prefix so as not to refer to a
     * hidden method. When unhidden, merge it with the previous javadoc comment.
     *
     * Either a surface or surface texture must be set if a display or video sink
     * is needed.  Not calling this method or {@link #setTexture(SurfaceTexture)}
     * when playing back a video will result in only the audio track being played.
     *
     * @param sh the SurfaceHolder to use for video display
     */
    public void setDisplay(SurfaceHolder sh) {
        mSurfaceHolder = sh;
@@ -648,7 +644,8 @@ public class MediaPlayer
     * SurfaceTexture set as the video sink have an unspecified zero point,
     * and cannot be directly compared between different media sources or different
     * instances of the same media source, or across multiple runs of the same
     * program.
     * program.  The timestamp is normally monotonically increasing and unaffected
     * by time-of-day adjustments, but is reset when the position is set.
     */
    public void setTexture(SurfaceTexture st) {
        ParcelSurfaceTexture pst = null;
+3 −0
Original line number Diff line number Diff line
@@ -128,6 +128,9 @@ struct AwesomeNativeWindowRenderer : public AwesomeRenderer {
    }

    virtual void render(MediaBuffer *buffer) {
        int64_t timeUs;
        CHECK(buffer->meta_data()->findInt64(kKeyTime, &timeUs));
        native_window_set_buffers_timestamp(mNativeWindow.get(), timeUs * 1000);
        status_t err = mNativeWindow->queueBuffer(
                mNativeWindow.get(), buffer->graphicBuffer().get());
        if (err != 0) {