Skip to content

Commit

Permalink
Fix the hardware decoding failure issue on the Android platform. std:…
Browse files Browse the repository at this point in the history
…:string requires passing the valid length as a parameter.
  • Loading branch information
kevingpqi123 committed May 16, 2024
1 parent f4ef24c commit 9fb54c5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/platform/android/HardwareDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ bool HardwareDecoder::initDecoder(JNIEnv* env, const VideoFormat& format) {
for (auto& header : format.headers) {
char keyString[6];
snprintf(keyString, 6, "csd-%d", index);
auto key = SafeConvertToJString(env, std::string(keyString, 6));
auto key = SafeConvertToJString(env, std::string(keyString, 5));
auto bytes = env->NewDirectByteBuffer(const_cast<uint8_t*>(header->bytes()), header->size());
env->CallVoidMethod(mediaFormat, MediaFormat_setByteBuffer, key, bytes);
index++;
Expand Down

0 comments on commit 9fb54c5

Please sign in to comment.