mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-11-18 11:08:26 +00:00
#465: dom/media/webm, MDSM
This commit is contained in:
parent
b25a781014
commit
e55a369b74
@ -1185,7 +1185,7 @@ void MediaDecoderStateMachine::MaybeStartPlayback()
|
||||
MOZ_ASSERT(mState == DECODER_STATE_DECODING ||
|
||||
mState == DECODER_STATE_COMPLETED);
|
||||
|
||||
if (IsPlaying()) {
|
||||
if (MOZ_LIKELY(IsPlaying())) {
|
||||
// Logging this case is really spammy - don't do it.
|
||||
return;
|
||||
}
|
||||
@ -2443,7 +2443,7 @@ nsresult MediaDecoderStateMachine::RunStateMachine()
|
||||
}
|
||||
|
||||
case DECODER_STATE_DECODING: {
|
||||
if (IsDecodingFirstFrame()) {
|
||||
if (MOZ_UNLIKELY(IsDecodingFirstFrame())) {
|
||||
// We haven't completed decoding our first frames, we can't start
|
||||
// playback yet.
|
||||
return NS_OK;
|
||||
@ -2623,7 +2623,7 @@ MediaDecoderStateMachine::CheckFrameValidity(VideoData* aData)
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
|
||||
// Update corrupt-frames statistics
|
||||
if (aData->mImage && !aData->mImage->IsValid()) {
|
||||
if (aData->mImage && MOZ_UNLIKELY(!aData->mImage->IsValid())) {
|
||||
FrameStatistics& frameStats = *mFrameStats;
|
||||
frameStats.NotifyCorruptFrame();
|
||||
// If more than 10% of the last 30 frames have been corrupted, then try disabling
|
||||
@ -2792,7 +2792,7 @@ MediaDecoderStateMachine::DropAudioUpToSeekTarget(MediaData* aSample)
|
||||
audio->mAudioData.get() + (framesToPrune.value() * channels),
|
||||
frames * channels * sizeof(AudioDataValue));
|
||||
CheckedInt64 duration = FramesToUsecs(frames, mInfo.mAudio.mRate);
|
||||
if (!duration.isValid()) {
|
||||
if (MOZ_UNLIKELY(!duration.isValid())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
RefPtr<AudioData> data(new AudioData(audio->mOffset,
|
||||
|
@ -88,24 +88,24 @@ SoftwareWebMVideoDecoder::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||
AbstractMediaDecoder::AutoNotifyDecoded a(mReader->GetDecoder());
|
||||
|
||||
RefPtr<NesteggPacketHolder> holder(mReader->NextPacket(WebMReader::VIDEO));
|
||||
if (!holder) {
|
||||
if (MOZ_UNLIKELY(!holder)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nestegg_packet* packet = holder->Packet();
|
||||
unsigned int track = 0;
|
||||
int r = nestegg_packet_track(packet, &track);
|
||||
if (r == -1) {
|
||||
if (MOZ_UNLIKELY(r == -1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int count = 0;
|
||||
r = nestegg_packet_count(packet, &count);
|
||||
if (r == -1) {
|
||||
if (MOZ_UNLIKELY(r == -1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (count > 1) {
|
||||
if (MOZ_UNLIKELY(count > 1)) {
|
||||
NS_WARNING("Packet contains more than one video frame");
|
||||
return false;
|
||||
}
|
||||
@ -130,7 +130,7 @@ SoftwareWebMVideoDecoder::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||
unsigned char* data;
|
||||
size_t length;
|
||||
r = nestegg_packet_data(packet, 0, &data, &length);
|
||||
if (r == -1) {
|
||||
if (MOZ_UNLIKELY(r == -1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ SoftwareWebMVideoDecoder::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||
aKeyframeSkip = false;
|
||||
}
|
||||
|
||||
if (vpx_codec_decode(&mVPX, data, length, nullptr, 0)) {
|
||||
if (MOZ_UNLIKELY(vpx_codec_decode(&mVPX, data, length, nullptr, 0))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ SoftwareWebMVideoDecoder::DecodeVideoFrame(bool &aKeyframeSkip,
|
||||
si.is_kf,
|
||||
-1,
|
||||
picture);
|
||||
if (!v) {
|
||||
if (MOZ_UNLIKELY(!v)) {
|
||||
return false;
|
||||
}
|
||||
a.mParsed++;
|
||||
|
@ -417,7 +417,7 @@ bool WebMReader::DecodeAudioPacket(NesteggPacketHolder* aHolder)
|
||||
int r = 0;
|
||||
unsigned int count = 0;
|
||||
r = nestegg_packet_count(aHolder->Packet(), &count);
|
||||
if (r == -1) {
|
||||
if (MOZ_UNLIKELY(r == -1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -439,7 +439,7 @@ bool WebMReader::DecodeAudioPacket(NesteggPacketHolder* aHolder)
|
||||
return false;
|
||||
}
|
||||
decoded_frames += mAudioFrames;
|
||||
if (!decoded_frames.isValid()) {
|
||||
if (MOZ_UNLIKELY(!decoded_frames.isValid())) {
|
||||
NS_WARNING("Int overflow adding decoded_frames");
|
||||
return false;
|
||||
}
|
||||
@ -460,7 +460,7 @@ bool WebMReader::DecodeAudioPacket(NesteggPacketHolder* aHolder)
|
||||
unsigned char* data;
|
||||
size_t length;
|
||||
r = nestegg_packet_data(aHolder->Packet(), i, &data, &length);
|
||||
if (r == -1) {
|
||||
if (MOZ_UNLIKELY(r == -1)) {
|
||||
return false;
|
||||
}
|
||||
int64_t discardPadding = 0;
|
||||
@ -508,7 +508,7 @@ RefPtr<NesteggPacketHolder> WebMReader::NextPacket(TrackType aTrackType)
|
||||
|
||||
do {
|
||||
RefPtr<NesteggPacketHolder> holder = DemuxPacket();
|
||||
if (!holder) {
|
||||
if (MOZ_UNLIKELY(!holder)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -530,13 +530,13 @@ WebMReader::DemuxPacket()
|
||||
{
|
||||
nestegg_packet* packet;
|
||||
int r = nestegg_read_packet(mContext, &packet);
|
||||
if (r <= 0) {
|
||||
if (MOZ_UNLIKELY(r <= 0)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
unsigned int track = 0;
|
||||
r = nestegg_packet_track(packet, &track);
|
||||
if (r == -1) {
|
||||
if (MOZ_UNLIKELY(r == -1)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -548,7 +548,7 @@ WebMReader::DemuxPacket()
|
||||
unsigned char* data;
|
||||
size_t length;
|
||||
r = nestegg_packet_data(packet, 0, &data, &length);
|
||||
if (r == -1) {
|
||||
if (MOZ_UNLIKELY(r == -1)) {
|
||||
return nullptr;
|
||||
}
|
||||
vpx_codec_stream_info_t si;
|
||||
@ -576,7 +576,7 @@ bool WebMReader::DecodeAudioData()
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
|
||||
RefPtr<NesteggPacketHolder> holder(NextPacket(AUDIO));
|
||||
if (!holder) {
|
||||
if (MOZ_UNLIKELY(!holder)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -589,7 +589,7 @@ bool WebMReader::FilterPacketByTime(int64_t aEndTime, WebMPacketQueue& aOutput)
|
||||
// than aEndTime.
|
||||
while (true) {
|
||||
RefPtr<NesteggPacketHolder> holder(NextPacket(VIDEO));
|
||||
if (!holder) {
|
||||
if (MOZ_UNLIKELY(!holder)) {
|
||||
break;
|
||||
}
|
||||
int64_t tstamp = holder->Timestamp();
|
||||
@ -622,7 +622,7 @@ int64_t WebMReader::GetNextKeyframeTime(int64_t aTimeThreshold)
|
||||
int64_t keyframeTime = -1;
|
||||
while (!foundKeyframe) {
|
||||
RefPtr<NesteggPacketHolder> holder(NextPacket(VIDEO));
|
||||
if (!holder) {
|
||||
if (MOZ_UNLIKELY(!holder)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user