Skip to content

Commit

Permalink
Fixed issue where Data track fails to be added
Browse files Browse the repository at this point in the history
  • Loading branch information
getroot committed Jan 6, 2025
1 parent 0dba720 commit 04a3b4f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 26 deletions.
3 changes: 3 additions & 0 deletions src/projects/mediarouter/mediarouter_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,8 +888,11 @@ bool MediaRouteStream::NormalizeMediaPacket(std::shared_ptr<MediaTrack> &media_t
case cmn::BitstreamFormat::MP3:
result = ProcessMP3Stream(media_track, media_packet);
break;
// Data Format
case cmn::BitstreamFormat::ID3v2:
case cmn::BitstreamFormat::OVEN_EVENT:
case cmn::BitstreamFormat::CUE:
case cmn::BitstreamFormat::AMF:
result = true;
break;
case cmn::BitstreamFormat::JPEG:
Expand Down
33 changes: 11 additions & 22 deletions src/projects/modules/containers/mpegts/mpegts_packetizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,7 @@ namespace mpegts
return false;
}

if (media_track->GetMediaType() == cmn::MediaType::Data)
{
if (media_track->GetOriginBitstream() != cmn::BitstreamFormat::ID3v2)
{
logte("Data Track (%s bitstream format) is not supported", GetBitstreamFormatString(media_track->GetOriginBitstream()).CStr());
return false;
}
}
else if (media_track->GetMediaType() == cmn::MediaType::Audio || media_track->GetMediaType() == cmn::MediaType::Video)
if (media_track->GetMediaType() == cmn::MediaType::Audio || media_track->GetMediaType() == cmn::MediaType::Video)
{
auto stream_type = GetElementaryStreamTypeByCodecId(media_track->GetCodecId());
if (stream_type == WellKnownStreamTypes::None)
Expand Down Expand Up @@ -312,20 +304,17 @@ namespace mpegts
continue;
}

if (track->GetOriginBitstream() == cmn::BitstreamFormat::ID3v2)
auto es_info = std::make_shared<ESInfo>();
auto es_descriptor = BuildID3MetadataDescriptor();
auto es_descriptor_data = es_descriptor->Build();

if (es_descriptor_data != nullptr)
{
auto es_info = std::make_shared<ESInfo>();
auto es_descriptor = BuildID3MetadataDescriptor();
auto es_descriptor_data = es_descriptor->Build();

if (es_descriptor_data != nullptr)
{
es_info->_stream_type = static_cast<uint8_t>(WellKnownStreamTypes::METADATA_CARRIED_IN_PES);
es_info->_elementary_pid = GetElementaryPid(track->GetId());
es_info->_es_info_length = es_descriptor_data->GetLength();
es_info->_es_descriptors.emplace_back(es_descriptor);
_pmt._es_info_list.push_back(es_info);
}
es_info->_stream_type = static_cast<uint8_t>(WellKnownStreamTypes::METADATA_CARRIED_IN_PES);
es_info->_elementary_pid = GetElementaryPid(track->GetId());
es_info->_es_info_length = es_descriptor_data->GetLength();
es_info->_es_descriptors.emplace_back(es_descriptor);
_pmt._es_info_list.push_back(es_info);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/projects/providers/file/file_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ namespace pvd
data_track->SetId(FILE_DATA_TRACK_ID);
data_track->SetMediaType(cmn::MediaType::Data);
data_track->SetTimeBase(1, 1000);
data_track->SetOriginBitstream(cmn::BitstreamFormat::ID3v2);
data_track->SetOriginBitstream(cmn::BitstreamFormat::Unknown);

AddTrack(data_track);
}
Expand Down
2 changes: 1 addition & 1 deletion src/projects/providers/rtmp/rtmp_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2076,7 +2076,7 @@ namespace pvd
data_track->SetId(RTMP_DATA_TRACK_ID);
data_track->SetMediaType(cmn::MediaType::Data);
data_track->SetTimeBase(1, 1000);
data_track->SetOriginBitstream(cmn::BitstreamFormat::ID3v2);
data_track->SetOriginBitstream(cmn::BitstreamFormat::Unknown);

AddTrack(data_track);
}
Expand Down
4 changes: 2 additions & 2 deletions src/projects/providers/scheduled/scheduled_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ namespace pvd
data_track->SetId(kScheduledDataTrackId);
data_track->SetMediaType(cmn::MediaType::Data);
data_track->SetTimeBase(1, 1000); // Data track time base is always 1/1000 in
data_track->SetOriginBitstream(cmn::BitstreamFormat::ID3v2);
data_track->SetOriginBitstream(cmn::BitstreamFormat::Unknown);

UpdateTrack(data_track);
}
Expand Down Expand Up @@ -1177,7 +1177,7 @@ namespace pvd
data_track->SetId(kScheduledDataTrackId);
data_track->SetMediaType(cmn::MediaType::Data);
data_track->SetTimeBase(1, 1000); // Data track time base is always 1/1000 in
data_track->SetOriginBitstream(cmn::BitstreamFormat::ID3v2);
data_track->SetOriginBitstream(cmn::BitstreamFormat::Unknown);

UpdateTrack(data_track);
}
Expand Down

0 comments on commit 04a3b4f

Please sign in to comment.