Skip to content

Commit 2d6c394

Browse files
authored
Remove lastOutputBufferIndex from OHOSVideoDecoder. (#2744)
1 parent fbf2715 commit 2d6c394

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/platform/ohos/NativeDisplayLink.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717
/////////////////////////////////////////////////////////////////////////////////////////////////
1818

1919
#pragma once
20+
21+
// clang-format off
22+
#include <stdint.h>
2023
#include <native_vsync/native_vsync.h>
21-
#include <cstdint>
24+
// clang-format on
2225
#include <functional>
2326
#include <mutex>
2427
#include "rendering/utils/DisplayLink.h"

src/platform/ohos/OHOSVideoDecoder.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ DecodingResult OHOSVideoDecoder::onDecodeFrame() {
208208
codecBufferInfo = codecUserData->outputBufferInfoQueue.front();
209209
codecUserData->outputBufferInfoQueue.pop();
210210
lock.unlock();
211-
lastOutputBufferIndex = codecBufferInfo.bufferIndex;
212211
pendingFrames.remove(codecBufferInfo.attr.pts);
213212
if (codecBufferInfo.buffer == nullptr) {
214213
return DecodingResult::Error;
@@ -230,7 +229,6 @@ void OHOSVideoDecoder::onFlush() {
230229
}
231230
codecUserData->clearQueue();
232231
pendingFrames.clear();
233-
lastOutputBufferIndex = -1;
234232
codecBufferInfo = {0, nullptr};
235233
start();
236234
}
@@ -309,12 +307,12 @@ std::shared_ptr<tgfx::ImageBuffer> OHOSVideoDecoder::onRenderFrame() {
309307
}
310308

311309
void OHOSVideoDecoder::releaseOutputBuffer() {
312-
if (lastOutputBufferIndex != -1) {
310+
if (codecBufferInfo.buffer) {
313311
int ret = OH_VideoDecoder_FreeOutputBuffer(videoCodec, codecBufferInfo.bufferIndex);
314312
if (ret != AV_ERR_OK) {
315313
LOGE("OH_VideoDecoder_FreeOutputBuffer failed, ret:%d", ret);
316314
}
317-
lastOutputBufferIndex = -1;
315+
codecBufferInfo = {0, nullptr};
318316
}
319317
}
320318

src/platform/ohos/OHOSVideoDecoder.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ class OHOSVideoDecoder : public VideoDecoder {
9797
int64_t yBufferSize = 0;
9898
int64_t uvBufferSize = 0;
9999
std::weak_ptr<OHOSVideoDecoder> weakThis;
100-
int lastOutputBufferIndex = -1;
101100

102101
explicit OHOSVideoDecoder(const VideoFormat& format, bool hardware);
103102
bool initDecoder(const OH_AVCodecCategory avCodecCategory);

0 commit comments

Comments
 (0)