Skip to content

Commit 63423ec

Browse files
committed
define a constant and fix dangling pointer issue
1 parent a4b3153 commit 63423ec

File tree

7 files changed

+7
-14
lines changed

7 files changed

+7
-14
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

packages/video_player_avplay/tizen/src/plus_player.cc

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#define STB_IMAGE_WRITE_IMPLEMENTATION
1818
#include "stb_image_write.h"
1919

20+
#define SUBTITLE_ATTR_TYPE_COUNT 37
21+
2022
namespace video_player_avplay_tizen {
2123

2224
static std::vector<std::string> split(const std::string &s, char delim) {
@@ -1175,7 +1177,8 @@ void PlusPlayer::OnSubtitleData(char *data, const int size,
11751177
text_lines_count = text_lines.size();
11761178
}
11771179

1178-
std::vector<int> line_attr_index(37, text_lines_count - 1);
1180+
std::vector<int> line_attr_index(SUBTITLE_ATTR_TYPE_COUNT,
1181+
text_lines_count - 1);
11791182

11801183
// Pre-parse attributes to find width/height for picture subtitles.
11811184
double picture_width = 0.0;
@@ -1276,19 +1279,9 @@ void PlusPlayer::OnSubtitleData(char *data, const int size,
12761279
break;
12771280
}
12781281

1279-
// TODO
1280-
if (attr->type != plusplayer::kSubAttrFontFamily) {
1281-
int index = line_attr_index[attr->type]--;
1282-
if (index >= 0) {
1283-
attributes_lines[index].push_back(flutter::EncodableValue(attributes));
1284-
}
1285-
} else {
1286-
if (line_attr_index[attr->type] == 0) {
1287-
for (int i = 0; i < text_lines_count; i++) {
1288-
attributes_lines[i].push_back(flutter::EncodableValue(attributes));
1289-
}
1290-
}
1291-
line_attr_index[attr->type]--;
1282+
int index = line_attr_index[attr->type]--;
1283+
if (index >= 0) {
1284+
attributes_lines[index].push_back(flutter::EncodableValue(attributes));
12921285
}
12931286
}
12941287

0 commit comments

Comments
 (0)