Bug 1524890 - P5. Make MediaData::Type an enum class. r=bryce

Make its use more explicit and less likely to be incorrect.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jean-Yves Avenard 2019-02-22 09:18:18 +00:00
Родитель 1f5dfb6d37
Коммит 964cc95e13
9 изменённых файлов: 72 добавлений и 52 удалений

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

@ -127,7 +127,7 @@ VideoData::VideoData(int64_t aOffset, const TimeUnit& aTime,
const TimeUnit& aDuration, bool aKeyframe, const TimeUnit& aDuration, bool aKeyframe,
const TimeUnit& aTimecode, IntSize aDisplay, const TimeUnit& aTimecode, IntSize aDisplay,
layers::ImageContainer::FrameID aFrameID) layers::ImageContainer::FrameID aFrameID)
: MediaData(VIDEO_DATA, aOffset, aTime, aDuration, 1), : MediaData(Type::VIDEO_DATA, aOffset, aTime, aDuration, 1),
mDisplay(aDisplay), mDisplay(aDisplay),
mFrameID(aFrameID), mFrameID(aFrameID),
mSentToCompositor(false), mSentToCompositor(false),
@ -354,14 +354,16 @@ already_AddRefed<VideoData> VideoData::CreateFromImage(
} }
MediaRawData::MediaRawData() MediaRawData::MediaRawData()
: MediaData(RAW_DATA, 0), mCrypto(mCryptoInternal) {} : MediaData(Type::RAW_DATA, 0), mCrypto(mCryptoInternal) {}
MediaRawData::MediaRawData(const uint8_t* aData, size_t aSize) MediaRawData::MediaRawData(const uint8_t* aData, size_t aSize)
: MediaData(RAW_DATA, 0), mCrypto(mCryptoInternal), mBuffer(aData, aSize) {} : MediaData(Type::RAW_DATA, 0),
mCrypto(mCryptoInternal),
mBuffer(aData, aSize) {}
MediaRawData::MediaRawData(const uint8_t* aData, size_t aSize, MediaRawData::MediaRawData(const uint8_t* aData, size_t aSize,
const uint8_t* aAlphaData, size_t aAlphaSize) const uint8_t* aAlphaData, size_t aAlphaSize)
: MediaData(RAW_DATA, 0), : MediaData(Type::RAW_DATA, 0),
mCrypto(mCryptoInternal), mCrypto(mCryptoInternal),
mBuffer(aData, aSize), mBuffer(aData, aSize),
mAlphaBuffer(aAlphaData, aAlphaSize) {} mAlphaBuffer(aAlphaData, aAlphaSize) {}

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

@ -251,7 +251,21 @@ class MediaData {
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaData) NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaData)
enum Type { AUDIO_DATA = 0, VIDEO_DATA, RAW_DATA, NULL_DATA }; enum class Type { AUDIO_DATA = 0, VIDEO_DATA, RAW_DATA, NULL_DATA };
static const char* TypeToStr(Type aType) {
switch (aType) {
case Type::AUDIO_DATA:
return "AUDIO_DATA";
case Type::VIDEO_DATA:
return "VIDEO_DATA";
case Type::RAW_DATA:
return "RAW_DATA";
case Type::NULL_DATA:
return "NULL_DATA";
default:
MOZ_CRASH("bad value");
}
}
MediaData(Type aType, int64_t aOffset, const media::TimeUnit& aTimestamp, MediaData(Type aType, int64_t aOffset, const media::TimeUnit& aTimestamp,
const media::TimeUnit& aDuration, uint32_t aFrames) const media::TimeUnit& aDuration, uint32_t aFrames)
@ -316,9 +330,9 @@ class NullData : public MediaData {
public: public:
NullData(int64_t aOffset, const media::TimeUnit& aTime, NullData(int64_t aOffset, const media::TimeUnit& aTime,
const media::TimeUnit& aDuration) const media::TimeUnit& aDuration)
: MediaData(NULL_DATA, aOffset, aTime, aDuration, 0) {} : MediaData(Type::NULL_DATA, aOffset, aTime, aDuration, 0) {}
static const Type sType = NULL_DATA; static const Type sType = Type::NULL_DATA;
}; };
// Holds chunk a decoded audio frames. // Holds chunk a decoded audio frames.
@ -334,7 +348,7 @@ class AudioData : public MediaData {
mRate(aRate), mRate(aRate),
mAudioData(std::move(aData)) {} mAudioData(std::move(aData)) {}
static const Type sType = AUDIO_DATA; static const Type sType = Type::AUDIO_DATA;
static const char* sTypeName; static const char* sTypeName;
// Access the buffer as a Span. // Access the buffer as a Span.
@ -390,7 +404,7 @@ class VideoData : public MediaData {
typedef layers::Image Image; typedef layers::Image Image;
typedef layers::PlanarYCbCrImage PlanarYCbCrImage; typedef layers::PlanarYCbCrImage PlanarYCbCrImage;
static const Type sType = VIDEO_DATA; static const Type sType = Type::VIDEO_DATA;
static const char* sTypeName; static const char* sTypeName;
// YCbCr data obtained from decoding the video. The index's are: // YCbCr data obtained from decoding the video. The index's are:

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

@ -471,7 +471,7 @@ class MediaDecoderStateMachine::DecodingFirstFrameState
} }
void HandleWaitingForAudio() override { void HandleWaitingForAudio() override {
mMaster->WaitForData(MediaData::AUDIO_DATA); mMaster->WaitForData(MediaData::Type::AUDIO_DATA);
} }
void HandleAudioCanceled() override { mMaster->RequestAudioData(); } void HandleAudioCanceled() override { mMaster->RequestAudioData(); }
@ -482,7 +482,7 @@ class MediaDecoderStateMachine::DecodingFirstFrameState
} }
void HandleWaitingForVideo() override { void HandleWaitingForVideo() override {
mMaster->WaitForData(MediaData::VIDEO_DATA); mMaster->WaitForData(MediaData::Type::VIDEO_DATA);
} }
void HandleVideoCanceled() override { void HandleVideoCanceled() override {
@ -586,12 +586,12 @@ class MediaDecoderStateMachine::DecodingState
void HandleEndOfVideo() override; void HandleEndOfVideo() override;
void HandleWaitingForAudio() override { void HandleWaitingForAudio() override {
mMaster->WaitForData(MediaData::AUDIO_DATA); mMaster->WaitForData(MediaData::Type::AUDIO_DATA);
MaybeStopPrerolling(); MaybeStopPrerolling();
} }
void HandleWaitingForVideo() override { void HandleWaitingForVideo() override {
mMaster->WaitForData(MediaData::VIDEO_DATA); mMaster->WaitForData(MediaData::Type::VIDEO_DATA);
MaybeStopPrerolling(); MaybeStopPrerolling();
} }
@ -1099,7 +1099,7 @@ class MediaDecoderStateMachine::AccurateSeekingState
void HandleWaitingForAudio() override { void HandleWaitingForAudio() override {
MOZ_ASSERT(!mDoneAudioSeeking); MOZ_ASSERT(!mDoneAudioSeeking);
mMaster->WaitForData(MediaData::AUDIO_DATA); mMaster->WaitForData(MediaData::Type::AUDIO_DATA);
} }
void HandleAudioCanceled() override { void HandleAudioCanceled() override {
@ -1114,7 +1114,7 @@ class MediaDecoderStateMachine::AccurateSeekingState
void HandleWaitingForVideo() override { void HandleWaitingForVideo() override {
MOZ_ASSERT(!mDoneVideoSeeking); MOZ_ASSERT(!mDoneVideoSeeking);
mMaster->WaitForData(MediaData::VIDEO_DATA); mMaster->WaitForData(MediaData::Type::VIDEO_DATA);
} }
void HandleVideoCanceled() override { void HandleVideoCanceled() override {
@ -1216,14 +1216,15 @@ class MediaDecoderStateMachine::AccurateSeekingState
mSeekRequest.Complete(); mSeekRequest.Complete();
if (aReject.mError == NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA) { if (aReject.mError == NS_ERROR_DOM_MEDIA_WAITING_FOR_DATA) {
SLOG("OnSeekRejected reason=WAITING_FOR_DATA type=%d", aReject.mType); SLOG("OnSeekRejected reason=WAITING_FOR_DATA type=%s",
MOZ_ASSERT_IF(aReject.mType == MediaData::AUDIO_DATA, MediaData::TypeToStr(aReject.mType));
MOZ_ASSERT_IF(aReject.mType == MediaData::Type::AUDIO_DATA,
!mMaster->IsRequestingAudioData()); !mMaster->IsRequestingAudioData());
MOZ_ASSERT_IF(aReject.mType == MediaData::VIDEO_DATA, MOZ_ASSERT_IF(aReject.mType == MediaData::Type::VIDEO_DATA,
!mMaster->IsRequestingVideoData()); !mMaster->IsRequestingVideoData());
MOZ_ASSERT_IF(aReject.mType == MediaData::AUDIO_DATA, MOZ_ASSERT_IF(aReject.mType == MediaData::Type::AUDIO_DATA,
!mMaster->IsWaitingAudioData()); !mMaster->IsWaitingAudioData());
MOZ_ASSERT_IF(aReject.mType == MediaData::VIDEO_DATA, MOZ_ASSERT_IF(aReject.mType == MediaData::Type::VIDEO_DATA,
!mMaster->IsWaitingVideoData()); !mMaster->IsWaitingVideoData());
// Fire 'waiting' to notify the player that we are waiting for data. // Fire 'waiting' to notify the player that we are waiting for data.
@ -1523,7 +1524,7 @@ class MediaDecoderStateMachine::NextFrameSeekingState
void HandleWaitingForVideo() override { void HandleWaitingForVideo() override {
MOZ_ASSERT(!mSeekJob.mPromise.IsEmpty(), "Seek shouldn't be finished"); MOZ_ASSERT(!mSeekJob.mPromise.IsEmpty(), "Seek shouldn't be finished");
MOZ_ASSERT(NeedMoreVideo()); MOZ_ASSERT(NeedMoreVideo());
mMaster->WaitForData(MediaData::VIDEO_DATA); mMaster->WaitForData(MediaData::Type::VIDEO_DATA);
} }
void HandleVideoCanceled() override { void HandleVideoCanceled() override {
@ -1885,11 +1886,11 @@ class MediaDecoderStateMachine::BufferingState
} }
void HandleWaitingForAudio() override { void HandleWaitingForAudio() override {
mMaster->WaitForData(MediaData::AUDIO_DATA); mMaster->WaitForData(MediaData::Type::AUDIO_DATA);
} }
void HandleWaitingForVideo() override { void HandleWaitingForVideo() override {
mMaster->WaitForData(MediaData::VIDEO_DATA); mMaster->WaitForData(MediaData::Type::VIDEO_DATA);
} }
void HandleAudioWaited(MediaData::Type aType) override { void HandleAudioWaited(MediaData::Type aType) override {
@ -3183,14 +3184,15 @@ void MediaDecoderStateMachine::RequestVideoData(
void MediaDecoderStateMachine::WaitForData(MediaData::Type aType) { void MediaDecoderStateMachine::WaitForData(MediaData::Type aType) {
MOZ_ASSERT(OnTaskQueue()); MOZ_ASSERT(OnTaskQueue());
MOZ_ASSERT(aType == MediaData::AUDIO_DATA || aType == MediaData::VIDEO_DATA); MOZ_ASSERT(aType == MediaData::Type::AUDIO_DATA ||
aType == MediaData::Type::VIDEO_DATA);
RefPtr<MediaDecoderStateMachine> self = this; RefPtr<MediaDecoderStateMachine> self = this;
if (aType == MediaData::AUDIO_DATA) { if (aType == MediaData::Type::AUDIO_DATA) {
mReader->WaitForData(MediaData::AUDIO_DATA) mReader->WaitForData(MediaData::Type::AUDIO_DATA)
->Then(OwnerThread(), __func__, ->Then(OwnerThread(), __func__,
[self](MediaData::Type aType) { [self](MediaData::Type aType) {
self->mAudioWaitRequest.Complete(); self->mAudioWaitRequest.Complete();
MOZ_ASSERT(aType == MediaData::AUDIO_DATA); MOZ_ASSERT(aType == MediaData::Type::AUDIO_DATA);
self->mStateObj->HandleAudioWaited(aType); self->mStateObj->HandleAudioWaited(aType);
}, },
[self](const WaitForDataRejectValue& aRejection) { [self](const WaitForDataRejectValue& aRejection) {
@ -3199,11 +3201,11 @@ void MediaDecoderStateMachine::WaitForData(MediaData::Type aType) {
}) })
->Track(mAudioWaitRequest); ->Track(mAudioWaitRequest);
} else { } else {
mReader->WaitForData(MediaData::VIDEO_DATA) mReader->WaitForData(MediaData::Type::VIDEO_DATA)
->Then(OwnerThread(), __func__, ->Then(OwnerThread(), __func__,
[self](MediaData::Type aType) { [self](MediaData::Type aType) {
self->mVideoWaitRequest.Complete(); self->mVideoWaitRequest.Complete();
MOZ_ASSERT(aType == MediaData::VIDEO_DATA); MOZ_ASSERT(aType == MediaData::Type::VIDEO_DATA);
self->mStateObj->HandleVideoWaited(aType); self->mStateObj->HandleVideoWaited(aType);
}, },
[self](const WaitForDataRejectValue& aRejection) { [self](const WaitForDataRejectValue& aRejection) {

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

@ -307,7 +307,7 @@ void MediaFormatReader::DecoderData::ShutdownDecoder() {
// we can forget mDecoder and be ready to create a new one. // we can forget mDecoder and be ready to create a new one.
mDecoder = nullptr; mDecoder = nullptr;
mDescription = NS_LITERAL_CSTRING("shutdown"); mDescription = NS_LITERAL_CSTRING("shutdown");
mOwner->ScheduleUpdate(mType == MediaData::AUDIO_DATA mOwner->ScheduleUpdate(mType == MediaData::Type::AUDIO_DATA
? TrackType::kAudioTrack ? TrackType::kAudioTrack
: TrackType::kVideoTrack); : TrackType::kVideoTrack);
} }
@ -326,8 +326,9 @@ void MediaFormatReader::DecoderData::Flush() {
mNumSamplesOutput = 0; mNumSamplesOutput = 0;
mSizeOfQueue = 0; mSizeOfQueue = 0;
if (mDecoder) { if (mDecoder) {
TrackType type = mType == MediaData::AUDIO_DATA ? TrackType::kAudioTrack TrackType type = mType == MediaData::Type::AUDIO_DATA
: TrackType::kVideoTrack; ? TrackType::kAudioTrack
: TrackType::kVideoTrack;
mFlushing = true; mFlushing = true;
MOZ_DIAGNOSTIC_ASSERT(!mShutdownPromise); MOZ_DIAGNOSTIC_ASSERT(!mShutdownPromise);
mShutdownPromise = new SharedShutdownPromiseHolder(); mShutdownPromise = new SharedShutdownPromiseHolder();
@ -972,9 +973,9 @@ MediaFormatReader::MediaFormatReader(MediaFormatReaderInit& aInit,
: mTaskQueue(new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK), : mTaskQueue(new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK),
"MediaFormatReader::mTaskQueue", "MediaFormatReader::mTaskQueue",
/* aSupportsTailDispatch = */ true)), /* aSupportsTailDispatch = */ true)),
mAudio(this, MediaData::AUDIO_DATA, mAudio(this, MediaData::Type::AUDIO_DATA,
StaticPrefs::MediaAudioMaxDecodeError()), StaticPrefs::MediaAudioMaxDecodeError()),
mVideo(this, MediaData::VIDEO_DATA, mVideo(this, MediaData::Type::VIDEO_DATA,
StaticPrefs::MediaVideoMaxDecodeError()), StaticPrefs::MediaVideoMaxDecodeError()),
mDemuxer(new DemuxerProxy(aDemuxer)), mDemuxer(new DemuxerProxy(aDemuxer)),
mDemuxerInitDone(false), mDemuxerInitDone(false),
@ -1676,7 +1677,7 @@ void MediaFormatReader::NotifyNewOutput(
for (auto&& sample : aResults) { for (auto&& sample : aResults) {
if (DecoderDoctorLogger::IsDDLoggingEnabled()) { if (DecoderDoctorLogger::IsDDLoggingEnabled()) {
switch (sample->mType) { switch (sample->mType) {
case MediaData::AUDIO_DATA: case MediaData::Type::AUDIO_DATA:
DDLOGPR(DDLogCategory::Log, DDLOGPR(DDLogCategory::Log,
aTrack == TrackInfo::kAudioTrack ? "decoded_audio" aTrack == TrackInfo::kAudioTrack ? "decoded_audio"
: "decoded_got_audio!?", : "decoded_got_audio!?",
@ -1693,7 +1694,7 @@ void MediaFormatReader::NotifyNewOutput(
sample->As<AudioData>()->mRate, sample->As<AudioData>()->mRate,
sample->As<AudioData>()->Data().Length()); sample->As<AudioData>()->Data().Length());
break; break;
case MediaData::VIDEO_DATA: case MediaData::Type::VIDEO_DATA:
DDLOGPR(DDLogCategory::Log, DDLOGPR(DDLogCategory::Log,
aTrack == TrackInfo::kVideoTrack ? "decoded_video" aTrack == TrackInfo::kVideoTrack ? "decoded_video"
: "decoded_got_video!?", : "decoded_got_video!?",
@ -1708,7 +1709,7 @@ void MediaFormatReader::NotifyNewOutput(
sample->As<VideoData>()->mDisplay.width, sample->As<VideoData>()->mDisplay.width,
sample->As<VideoData>()->mDisplay.height); sample->As<VideoData>()->mDisplay.height);
break; break;
case MediaData::RAW_DATA: case MediaData::Type::RAW_DATA:
DDLOGPR(DDLogCategory::Log, DDLOGPR(DDLogCategory::Log,
aTrack == TrackInfo::kAudioTrack aTrack == TrackInfo::kAudioTrack
? "decoded_audio" ? "decoded_audio"
@ -1723,7 +1724,7 @@ void MediaFormatReader::NotifyNewOutput(
sample->mDuration.ToMicroseconds(), sample->mFrames, sample->mDuration.ToMicroseconds(), sample->mFrames,
sample->mKeyframe ? "true" : "false"); sample->mKeyframe ? "true" : "false");
break; break;
case MediaData::NULL_DATA: case MediaData::Type::NULL_DATA:
DDLOGPR(DDLogCategory::Log, DDLOGPR(DDLogCategory::Log,
aTrack == TrackInfo::kAudioTrack aTrack == TrackInfo::kAudioTrack
? "decoded_audio" ? "decoded_audio"
@ -2252,7 +2253,7 @@ void MediaFormatReader::Update(TrackType aTrack) {
} }
while (decoder.mOutput.Length() && while (decoder.mOutput.Length() &&
decoder.mOutput[0]->mType == MediaData::NULL_DATA) { decoder.mOutput[0]->mType == MediaData::Type::NULL_DATA) {
LOGV("Dropping null data. Time: %" PRId64, LOGV("Dropping null data. Time: %" PRId64,
decoder.mOutput[0]->mTime.ToMicroseconds()); decoder.mOutput[0]->mTime.ToMicroseconds());
decoder.mOutput.RemoveElementAt(0); decoder.mOutput.RemoveElementAt(0);
@ -2467,7 +2468,7 @@ void MediaFormatReader::Update(TrackType aTrack) {
void MediaFormatReader::ReturnOutput(MediaData* aData, TrackType aTrack) { void MediaFormatReader::ReturnOutput(MediaData* aData, TrackType aTrack) {
MOZ_ASSERT(GetDecoderData(aTrack).HasPromise()); MOZ_ASSERT(GetDecoderData(aTrack).HasPromise());
MOZ_DIAGNOSTIC_ASSERT(aData->mType != MediaData::NULL_DATA); MOZ_DIAGNOSTIC_ASSERT(aData->mType != MediaData::Type::NULL_DATA);
LOG("Resolved data promise for %s [%" PRId64 ", %" PRId64 "]", LOG("Resolved data promise for %s [%" PRId64 ", %" PRId64 "]",
TrackTypeToStr(aTrack), aData->mTime.ToMicroseconds(), TrackTypeToStr(aTrack), aData->mTime.ToMicroseconds(),
aData->GetEndTime().ToMicroseconds()); aData->GetEndTime().ToMicroseconds());
@ -2526,8 +2527,9 @@ size_t MediaFormatReader::SizeOfQueue(TrackType aTrack) {
RefPtr<MediaFormatReader::WaitForDataPromise> MediaFormatReader::WaitForData( RefPtr<MediaFormatReader::WaitForDataPromise> MediaFormatReader::WaitForData(
MediaData::Type aType) { MediaData::Type aType) {
MOZ_ASSERT(OnTaskQueue()); MOZ_ASSERT(OnTaskQueue());
TrackType trackType = aType == MediaData::VIDEO_DATA ? TrackType::kVideoTrack TrackType trackType = aType == MediaData::Type::VIDEO_DATA
: TrackType::kAudioTrack; ? TrackType::kVideoTrack
: TrackType::kAudioTrack;
auto& decoder = GetDecoderData(trackType); auto& decoder = GetDecoderData(trackType);
if (!decoder.IsWaitingForData() && !decoder.IsWaitingForKey()) { if (!decoder.IsWaitingForData() && !decoder.IsWaitingForKey()) {
// We aren't waiting for anything. // We aren't waiting for anything.
@ -2548,14 +2550,14 @@ nsresult MediaFormatReader::ResetDecode(TrackSet aTracks) {
// Do the same for any data wait promises. // Do the same for any data wait promises.
if (aTracks.contains(TrackInfo::kAudioTrack)) { if (aTracks.contains(TrackInfo::kAudioTrack)) {
mAudio.mWaitingPromise.RejectIfExists( mAudio.mWaitingPromise.RejectIfExists(
WaitForDataRejectValue(MediaData::AUDIO_DATA, WaitForDataRejectValue(MediaData::Type::AUDIO_DATA,
WaitForDataRejectValue::CANCELED), WaitForDataRejectValue::CANCELED),
__func__); __func__);
} }
if (aTracks.contains(TrackInfo::kVideoTrack)) { if (aTracks.contains(TrackInfo::kVideoTrack)) {
mVideo.mWaitingPromise.RejectIfExists( mVideo.mWaitingPromise.RejectIfExists(
WaitForDataRejectValue(MediaData::VIDEO_DATA, WaitForDataRejectValue(MediaData::Type::VIDEO_DATA,
WaitForDataRejectValue::CANCELED), WaitForDataRejectValue::CANCELED),
__func__); __func__);
} }
@ -2821,8 +2823,8 @@ void MediaFormatReader::OnSeekFailed(TrackType aTrack,
MOZ_ASSERT(!mVideo.mSeekRequest.Exists() && !mAudio.mSeekRequest.Exists()); MOZ_ASSERT(!mVideo.mSeekRequest.Exists() && !mAudio.mSeekRequest.Exists());
mPendingSeekTime.reset(); mPendingSeekTime.reset();
auto type = aTrack == TrackType::kAudioTrack ? MediaData::AUDIO_DATA auto type = aTrack == TrackType::kAudioTrack ? MediaData::Type::AUDIO_DATA
: MediaData::VIDEO_DATA; : MediaData::Type::VIDEO_DATA;
mSeekPromise.Reject(SeekRejectValue(type, aError), __func__); mSeekPromise.Reject(SeekRejectValue(type, aError), __func__);
} }

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

@ -41,9 +41,9 @@ struct WaitForDataRejectValue {
struct SeekRejectValue { struct SeekRejectValue {
MOZ_IMPLICIT SeekRejectValue(const MediaResult& aError) MOZ_IMPLICIT SeekRejectValue(const MediaResult& aError)
: mType(MediaData::NULL_DATA), mError(aError) {} : mType(MediaData::Type::NULL_DATA), mError(aError) {}
MOZ_IMPLICIT SeekRejectValue(nsresult aResult) MOZ_IMPLICIT SeekRejectValue(nsresult aResult)
: mType(MediaData::NULL_DATA), mError(aResult) {} : mType(MediaData::Type::NULL_DATA), mError(aResult) {}
SeekRejectValue(MediaData::Type aType, const MediaResult& aError) SeekRejectValue(MediaData::Type aType, const MediaResult& aError)
: mType(aType), mError(aError) {} : mType(aType), mError(aError) {}
MediaData::Type mType; MediaData::Type mType;

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

@ -98,7 +98,7 @@ void RemoteAudioDecoderParent::ProcessDecodedData(
MOZ_ASSERT(OnManagerThread()); MOZ_ASSERT(OnManagerThread());
for (const auto& data : aData) { for (const auto& data : aData) {
MOZ_ASSERT(data->mType == MediaData::AUDIO_DATA, MOZ_ASSERT(data->mType == MediaData::Type::AUDIO_DATA,
"Can only decode audio using RemoteAudioDecoderParent!"); "Can only decode audio using RemoteAudioDecoderParent!");
AudioData* audio = static_cast<AudioData*>(data.get()); AudioData* audio = static_cast<AudioData*>(data.get());

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

@ -170,7 +170,7 @@ void RemoteVideoDecoderParent::ProcessDecodedData(
MOZ_ASSERT(OnManagerThread()); MOZ_ASSERT(OnManagerThread());
for (const auto& data : aData) { for (const auto& data : aData) {
MOZ_ASSERT(data->mType == MediaData::VIDEO_DATA, MOZ_ASSERT(data->mType == MediaData::Type::VIDEO_DATA,
"Can only decode videos using RemoteDecoderParent!"); "Can only decode videos using RemoteDecoderParent!");
VideoData* video = static_cast<VideoData*>(data.get()); VideoData* video = static_cast<VideoData*>(data.get());

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

@ -172,7 +172,7 @@ void VideoDecoderParent::ProcessDecodedData(
} }
for (auto&& data : aData) { for (auto&& data : aData) {
MOZ_ASSERT(data->mType == MediaData::VIDEO_DATA, MOZ_ASSERT(data->mType == MediaData::Type::VIDEO_DATA,
"Can only decode videos using VideoDecoderParent!"); "Can only decode videos using VideoDecoderParent!");
VideoData* video = static_cast<VideoData*>(data.get()); VideoData* video = static_cast<VideoData*>(data.get());

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

@ -111,7 +111,7 @@ int32_t WebrtcMediaDataDecoder::Decode(
[&](const MediaResult& aError) { mError = aError; }); [&](const MediaResult& aError) { mError = aError; });
for (auto& frame : mResults) { for (auto& frame : mResults) {
MOZ_ASSERT(frame->mType == MediaData::VIDEO_DATA); MOZ_ASSERT(frame->mType == MediaData::Type::VIDEO_DATA);
RefPtr<VideoData> video = frame->As<VideoData>(); RefPtr<VideoData> video = frame->As<VideoData>();
MOZ_ASSERT(video); MOZ_ASSERT(video);
if (!video->mImage) { if (!video->mImage) {