Bug 1355745 - Change the type of TrackInfo::mMediaTime to TimeUnit. r?jya
MozReview-Commit-ID: 3vuPhLQBnFb
--- a/dom/media/MediaInfo.h
+++ b/dom/media/MediaInfo.h
@@ -57,17 +57,16 @@ public:
bool aEnabled,
TrackID aTrackId)
: mId(aId)
, mKind(aKind)
, mLabel(aLabel)
, mLanguage(aLanguage)
, mEnabled(aEnabled)
, mTrackId(aTrackId)
- , mMediaTime(0)
, mIsRenderedExternally(false)
, mType(aType)
{
MOZ_COUNT_CTOR(TrackInfo);
}
// Only used for backward compatibility. Do not use in new code.
void Init(const nsAString& aId,
@@ -89,17 +88,17 @@ public:
nsString mLabel;
nsString mLanguage;
bool mEnabled;
TrackID mTrackId;
nsCString mMimeType;
media::TimeUnit mDuration;
- int64_t mMediaTime;
+ media::TimeUnit mMediaTime;
CryptoTrack mCrypto;
nsTArray<MetadataTag> mTags;
// True if the track is gonna be (decrypted)/decoded and
// rendered directly by non-gecko components.
bool mIsRenderedExternally;
--- a/dom/media/fmp4/MP4Decoder.cpp
+++ b/dom/media/fmp4/MP4Decoder.cpp
@@ -216,17 +216,16 @@ static const uint8_t sTestH264ExtraData[
static already_AddRefed<MediaDataDecoder>
CreateTestH264Decoder(layers::KnowsCompositor* aKnowsCompositor,
VideoInfo& aConfig,
TaskQueue* aTaskQueue)
{
aConfig.mMimeType = "video/avc";
aConfig.mId = 1;
aConfig.mDuration = media::TimeUnit::FromMicroseconds(40000);
- aConfig.mMediaTime = 0;
aConfig.mImage = aConfig.mDisplay = nsIntSize(640, 360);
aConfig.mExtraData = new MediaByteBuffer();
aConfig.mExtraData->AppendElements(sTestH264ExtraData,
MOZ_ARRAY_LENGTH(sTestH264ExtraData));
RefPtr<PDMFactory> platform = new PDMFactory();
RefPtr<MediaDataDecoder> decoder(platform->CreateDecoder({ aConfig, aTaskQueue, aKnowsCompositor }));
--- a/media/libstagefright/binding/DecoderData.cpp
+++ b/media/libstagefright/binding/DecoderData.cpp
@@ -112,17 +112,18 @@ static void
UpdateTrackInfo(mozilla::TrackInfo& aConfig,
const MetaData* aMetaData,
const char* aMimeType)
{
mozilla::CryptoTrack& crypto = aConfig.mCrypto;
aConfig.mMimeType = aMimeType;
aConfig.mDuration = TimeUnit::FromMicroseconds(
FindInt64(aMetaData, kKeyDuration));
- aConfig.mMediaTime = FindInt64(aMetaData, kKeyMediaTime);
+ aConfig.mMediaTime = TimeUnit::FromMicroseconds(
+ FindInt64(aMetaData, kKeyMediaTime));
aConfig.mTrackId = FindInt32(aMetaData, kKeyTrackID);
aConfig.mCrypto.mValid = aMetaData->findInt32(kKeyCryptoMode, &crypto.mMode) &&
aMetaData->findInt32(kKeyCryptoDefaultIVSize, &crypto.mIVSize) &&
FindData(aMetaData, kKeyCryptoKey, &crypto.mKeyId);
}
void
MP4AudioInfo::Update(const MetaData* aMetaData,
@@ -226,17 +227,17 @@ MP4AudioInfo::Update(const mp4parse_trac
mMimeType = MEDIA_MIMETYPE_AUDIO_MPEG;
}
mRate = audio->sample_rate;
mChannels = audio->channels;
mBitDepth = audio->bit_depth;
mExtendedProfile = audio->profile;
mDuration = TimeUnit::FromMicroseconds(track->duration);
- mMediaTime = track->media_time;
+ mMediaTime = TimeUnit::FromMicroseconds(track->media_time);
mTrackId = track->track_id;
// In stagefright, mProfile is kKeyAACProfile, mExtendedProfile is kKeyAACAOT.
// Both are from audioObjectType in AudioSpecificConfig.
if (audio->profile <= 4) {
mProfile = audio->profile;
}
@@ -258,17 +259,17 @@ MP4VideoInfo::Update(const mp4parse_trac
UpdateTrackProtectedInfo(*this, video->protected_data);
if (track->codec == mp4parse_codec_AVC) {
mMimeType = MEDIA_MIMETYPE_VIDEO_AVC;
} else if (track->codec == mp4parse_codec_VP9) {
mMimeType = NS_LITERAL_CSTRING("video/vp9");
}
mTrackId = track->track_id;
mDuration = TimeUnit::FromMicroseconds(track->duration);
- mMediaTime = track->media_time;
+ mMediaTime = TimeUnit::FromMicroseconds(track->media_time);
mDisplay.width = video->display_width;
mDisplay.height = video->display_height;
mImage.width = video->image_width;
mImage.height = video->image_height;
mRotation = ToSupportedRotation(video->rotation);
if (video->extra_data.data) {
mExtraData->AppendElements(video->extra_data.data, video->extra_data.length);
}