Skip to content

Commit

Permalink
KJSL: sync
Browse files Browse the repository at this point in the history
  • Loading branch information
kevleyski committed Sep 3, 2024
1 parent db05873 commit 75c2ecf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Source/C++/Apps/Mp4Mux/Mp4Mux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ AddAc3Track(AP4_Movie& movie,
if (!movie.GetTimeScale()) {
duration = sample_count * 1536;
} else {
duration = AP4_ConvertTime(1000*sample_table->GetSampleCount(), sample_rate, movie.GetTimeScale());
duration = AP4_ConvertTime(1536*sample_table->GetSampleCount(), sample_rate, movie.GetTimeScale());
}
AP4_ElstEntry new_elst_entry = AP4_ElstEntry(duration, 0, 1);
new_elst->AddEntry(new_elst_entry);
Expand Down Expand Up @@ -814,7 +814,7 @@ AddEac3Track(AP4_Movie& movie,
if (!movie.GetTimeScale()) {
duration = sample_count * 1536;
} else {
duration = AP4_ConvertTime(1000*sample_table->GetSampleCount(), sample_rate, movie.GetTimeScale());
duration = AP4_ConvertTime(1536*sample_table->GetSampleCount(), sample_rate, movie.GetTimeScale());
}
AP4_ElstEntry new_elst_entry = AP4_ElstEntry(duration, 0, 1);
new_elst->AddEntry(new_elst_entry);
Expand Down Expand Up @@ -962,7 +962,7 @@ AddAc4Track(AP4_Movie& movie,
if (!movie.GetTimeScale()) {
duration = AP4_UI64(sample_count) * sample_duration;
} else {
duration = AP4_ConvertTime(1000*sample_table->GetSampleCount(), media_time_scale, movie.GetTimeScale());
duration = AP4_ConvertTime(AP4_UI64(sample_count)*sample_table->GetSampleCount(), media_time_scale, movie.GetTimeScale());
}
AP4_ElstEntry new_elst_entry = AP4_ElstEntry(duration, 0, 1);
new_elst->AddEntry(new_elst_entry);
Expand Down
4 changes: 2 additions & 2 deletions Source/C++/Core/Ap4SampleDescription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ AP4_Av1SampleDescription::AP4_Av1SampleDescription(AP4_UI32 format,
+---------------------------------------------------------------------*/
AP4_Result
AP4_Av1SampleDescription::GetCodecString(AP4_String& codec) {
AP4_UI08 bit_depth = 10;
AP4_UI08 bit_depth = (this->GetHighBitDepth() == 0) ? 8: (this->GetTwelveBit() == 0 ? 10 : 12);
AP4_UI08 color_primaries = 1;
AP4_UI08 transfer_characteristics = 1;
AP4_UI08 matrix_coefficients = 1;
Expand All @@ -838,7 +838,7 @@ AP4_Av1SampleDescription::GetCodecString(AP4_String& codec) {
"%s.%d.%02d%c.%02d.%d.%d%d%d.%02d.%02d.%02d.%d",
coding,
this->GetSeqProfile(),
this->GetSeqLevelIdx0() >> 4,
this->GetSeqLevelIdx0(),
this->GetSeqTier0() == 0 ? 'M' : 'H',
bit_depth,
this->GetMonochrome(),
Expand Down
22 changes: 14 additions & 8 deletions Source/C++/Core/Ap4TrunAtom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
+---------------------------------------------------------------------*/
AP4_DEFINE_DYNAMIC_CAST_ANCHOR(AP4_TrunAtom)

/*----------------------------------------------------------------------
| constants
+---------------------------------------------------------------------*/
#define AP4_TRUN_MAX_SAMPLE_COUNT 0xFFFFFF

/*----------------------------------------------------------------------
| AP4_TrunAtom::Create
+---------------------------------------------------------------------*/
Expand Down Expand Up @@ -143,14 +148,15 @@ AP4_TrunAtom::AP4_TrunAtom(AP4_UI32 size,
}

int record_fields_count = (int)ComputeRecordFieldsCount(flags);
if (!record_fields_count) {
// nothing to read
return;
}

if ((bytes_left / (record_fields_count*4)) < sample_count) {
// not enough data for all samples, the format is invalid
return;
if (record_fields_count) {
if ((bytes_left / (record_fields_count*4)) < sample_count) {
// not enough data for all samples, the format is invalid
return;
}
} else {
if (sample_count > AP4_TRUN_MAX_SAMPLE_COUNT) {
return;
}
}

if (AP4_FAILED(m_Entries.SetItemCount(sample_count))) {
Expand Down

0 comments on commit 75c2ecf

Please sign in to comment.