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

Commit ab653c8d authored by Chong Zhang's avatar Chong Zhang
Browse files

Do not set buffer count to 1 if seeking to closest

It's okay to set to 1 when seeking to a sync frame. But for
closest we need to do some decoding, and some decoders might
not work with a single buffer.

bug: 27542615
Change-Id: I66f415ec87118c463f95a82848090842e628401f
parent 57d8e701
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -158,11 +158,14 @@ static VideoFrame *extractVideoFrame(
    // TODO: Use Flexible color instead
    videoFormat->setInt32("color-format", OMX_COLOR_FormatYUV420Planar);

    // For the thumbnail extraction case, try to allocate single buffer
    // in both input and output ports. NOTE: This request may fail if
    // component requires more than that for decoding.
    // For the thumbnail extraction case, try to allocate single buffer in both
    // input and output ports, if seeking to a sync frame. NOTE: This request may
    // fail if component requires more than that for decoding.
    bool isSeekingClosest = (seekMode == MediaSource::ReadOptions::SEEK_CLOSEST);
    if (!isSeekingClosest) {
        videoFormat->setInt32("android._num-input-buffers", 1);
        videoFormat->setInt32("android._num-output-buffers", 1);
    }

    status_t err;
    sp<ALooper> looper = new ALooper;
@@ -254,7 +257,6 @@ static VideoFrame *extractVideoFrame(
    bool isAvcOrHevc = !strcasecmp(mime, MEDIA_MIMETYPE_VIDEO_AVC)
            || !strcasecmp(mime, MEDIA_MIMETYPE_VIDEO_HEVC);

    bool isSeekingClosest = (seekMode == MediaSource::ReadOptions::SEEK_CLOSEST);
    bool firstSample = true;
    int64_t targetTimeUs = -1ll;