mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 960873: Part 5: Make gstreamer use AudioCompactor. r=cpearce
This commit is contained in:
parent
afd768e3f3
commit
82e0901439
@ -532,20 +532,20 @@ bool GStreamerReader::DecodeAudioData()
|
||||
timestamp = gst_segment_to_stream_time(&mAudioSegment,
|
||||
GST_FORMAT_TIME, timestamp);
|
||||
timestamp = GST_TIME_AS_USECONDS(timestamp);
|
||||
int64_t duration = 0;
|
||||
if (GST_CLOCK_TIME_IS_VALID(GST_BUFFER_DURATION(buffer)))
|
||||
duration = GST_TIME_AS_USECONDS(GST_BUFFER_DURATION(buffer));
|
||||
|
||||
int64_t offset = GST_BUFFER_OFFSET(buffer);
|
||||
unsigned int size = GST_BUFFER_SIZE(buffer);
|
||||
int32_t frames = (size / sizeof(AudioDataValue)) / mInfo.mAudio.mChannels;
|
||||
ssize_t outSize = static_cast<size_t>(size / sizeof(AudioDataValue));
|
||||
nsAutoArrayPtr<AudioDataValue> data(new AudioDataValue[outSize]);
|
||||
memcpy(data, GST_BUFFER_DATA(buffer), GST_BUFFER_SIZE(buffer));
|
||||
AudioData* audio = new AudioData(offset, timestamp, duration,
|
||||
frames, data.forget(), mInfo.mAudio.mChannels);
|
||||
|
||||
mAudioQueue.Push(audio);
|
||||
typedef AudioCompactor::NativeCopy GstCopy;
|
||||
mAudioCompactor.Push(offset,
|
||||
timestamp,
|
||||
mInfo.mAudio.mRate,
|
||||
frames,
|
||||
mInfo.mAudio.mChannels,
|
||||
GstCopy(GST_BUFFER_DATA(buffer),
|
||||
size,
|
||||
mInfo.mAudio.mChannels));
|
||||
gst_buffer_unref(buffer);
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user