Bug 493673. If a video frame has an audio track but no audio data at all, assume the audio has ended and stuff silence into the audio stream. We need this so that video will keep playing synced to the audio clock. r=roc

--HG--
extra : rebase_source : a1684fbd769ae48602335d312a33aa87ca17b8aa
This commit is contained in:
Chris Double 2009-05-19 17:39:40 +12:00
Родитель 1f03994614
Коммит 507f48d89a
1 изменённых файлов: 12 добавлений и 0 удалений

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

@ -742,6 +742,8 @@ nsOggDecodeStateMachine::FrameData* nsOggDecodeStateMachine::NextFrame()
}
}
PRBool needSilence = mAudioTrack != -1;
if (mAudioTrack != -1 &&
num_tracks > mAudioTrack &&
oggplay_callback_info_get_type(info[mAudioTrack]) == OGGPLAY_FLOATS_AUDIO) {
@ -753,10 +755,20 @@ nsOggDecodeStateMachine::FrameData* nsOggDecodeStateMachine::NextFrame()
int size = oggplay_callback_info_get_record_size(headers[j]);
OggPlayAudioData* audio_data = oggplay_callback_info_get_audio_data(headers[j]);
HandleAudioData(frame, audio_data, size);
needSilence = PR_FALSE;
}
}
}
if (needSilence) {
// Write silence to keep audio clock moving for av sync
size_t count = mAudioChannels * mAudioRate * mCallbackPeriod;
float* data = frame->mAudioData.AppendElements(count);
if (data) {
memset(data, 0, sizeof(float)*count);
}
}
// Pick one stream to act as the reference track to indicate if the
// stream has ended, seeked, etc.
if (videoTime >= 0) {