Bug 1454998 - Move TrackInfo::mTrackId away from TrackID as they're independent. r=karlt

TrackID has been used to denote tracks that are part of MediaStreams in the
MediaStreamGraph. The TrackInfo::mTrackId IDs are no longer used in the
MediaStream APIs and as such it's not necessary that they have the type TrackID.

This patch changes TrackInfo::mTrackId to be of type uint32_t instead, as that
is the type of Mp4parseTrackInfo::track_id, which is assigned to
TrackInfo::mTrackId as the sole remaining non-static user.

Other users set a static trackId of `1` or `2`, and as such remain supported by
this change.

Differential Revision: https://phabricator.services.mozilla.com/D46763

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2019-10-02 10:22:46 +00:00
Родитель 4a333d538b
Коммит 9ed4e1aa58
4 изменённых файлов: 10 добавлений и 23 удалений

Просмотреть файл

@ -10,7 +10,6 @@
#include "MediaInfo.h"
#include "MediaSegment.h"
#include "nsSize.h"
#include "TrackID.h"
namespace mozilla {

Просмотреть файл

@ -14,7 +14,6 @@
# include "AudioConfig.h"
# include "ImageTypes.h"
# include "MediaData.h"
# include "TrackID.h" // for TrackID
# include "TimeUnits.h"
# include "mozilla/gfx/Point.h" // for gfx::IntSize
# include "mozilla/gfx/Rect.h" // for gfx::IntRect
@ -44,7 +43,7 @@ class TrackInfo {
enum TrackType { kUndefinedTrack, kAudioTrack, kVideoTrack, kTextTrack };
TrackInfo(TrackType aType, const nsAString& aId, const nsAString& aKind,
const nsAString& aLabel, const nsAString& aLanguage, bool aEnabled,
TrackID aTrackId)
uint32_t aTrackId)
: mId(aId),
mKind(aKind),
mLabel(aLabel),
@ -74,7 +73,7 @@ class TrackInfo {
nsString mLanguage;
bool mEnabled;
TrackID mTrackId;
uint32_t mTrackId;
nsCString mMimeType;
media::TimeUnit mDuration;
@ -400,16 +399,6 @@ class MediaInfo {
bool HasValidMedia() const { return HasVideo() || HasAudio(); }
void AssertValid() const {
NS_ASSERTION(!HasAudio() || mAudio.mTrackId != TRACK_INVALID,
"Audio track ID must be valid");
NS_ASSERTION(!HasVideo() || mVideo.mTrackId != TRACK_INVALID,
"Audio track ID must be valid");
NS_ASSERTION(
!HasAudio() || !HasVideo() || mAudio.mTrackId != mVideo.mTrackId,
"Duplicate track IDs");
}
// TODO: Store VideoInfo and AudioIndo in arrays to support multi-tracks.
VideoInfo mVideo;
AudioInfo mAudio;

Просмотреть файл

@ -426,28 +426,27 @@ MP4Metadata::ResultAndCryptoFile MP4Metadata::Crypto() const {
return {NS_OK, &mCrypto};
}
MP4Metadata::ResultAndIndice MP4Metadata::GetTrackIndice(
mozilla::TrackID aTrackID) {
MP4Metadata::ResultAndIndice MP4Metadata::GetTrackIndice(uint32_t aTrackId) {
Mp4parseByteData indiceRawData = {};
uint8_t fragmented = false;
auto rv = mp4parse_is_fragmented(mParser.get(), aTrackID, &fragmented);
auto rv = mp4parse_is_fragmented(mParser.get(), aTrackId, &fragmented);
if (rv != MP4PARSE_STATUS_OK) {
return {MediaResult(NS_ERROR_DOM_MEDIA_METADATA_ERR,
RESULT_DETAIL("Cannot parse whether track id %d is "
RESULT_DETAIL("Cannot parse whether track id %u is "
"fragmented, mp4parse_error=%d",
int(aTrackID), int(rv))),
aTrackId, int(rv))),
nullptr};
}
if (!fragmented) {
rv = mp4parse_get_indice_table(mParser.get(), aTrackID, &indiceRawData);
rv = mp4parse_get_indice_table(mParser.get(), aTrackId, &indiceRawData);
if (rv != MP4PARSE_STATUS_OK) {
return {
MediaResult(NS_ERROR_DOM_MEDIA_METADATA_ERR,
RESULT_DETAIL("Cannot parse index table in track id %d, "
RESULT_DETAIL("Cannot parse index table in track id %u, "
"mp4parse_error=%d",
int(aTrackID), int(rv))),
aTrackId, int(rv))),
nullptr};
}
}

Просмотреть файл

@ -95,7 +95,7 @@ class MP4Metadata : public DecoderDoctorLifeLogger<MP4Metadata> {
ResultAndCryptoFile Crypto() const;
using ResultAndIndice = ResultAndType<mozilla::UniquePtr<IndiceWrapper>>;
ResultAndIndice GetTrackIndice(mozilla::TrackID aTrackID);
ResultAndIndice GetTrackIndice(uint32_t aTrackId);
nsresult Parse();