зеркало из https://github.com/mozilla/gecko-dev.git
Bug 825611 - Have MediaPipeline deliver as much media as requested. r=jesup
This commit is contained in:
Родитель
2d5f17e9d1
Коммит
d9f2a41f28
|
@ -822,31 +822,15 @@ nsresult MediaPipelineReceiveAudio::Init() {
|
|||
}
|
||||
|
||||
void MediaPipelineReceiveAudio::PipelineListener::
|
||||
NotifyPull(MediaStreamGraph* graph, StreamTime total) {
|
||||
NotifyPull(MediaStreamGraph* graph, StreamTime desired_time) {
|
||||
MOZ_ASSERT(source_);
|
||||
if (!source_) {
|
||||
MOZ_MTLOG(PR_LOG_ERROR, "NotifyPull() called from a non-SourceMediaStream");
|
||||
return;
|
||||
}
|
||||
|
||||
// "total" is absolute stream time.
|
||||
// StreamTime desired = total - played_;
|
||||
played_ = total;
|
||||
//double time_s = MediaTimeToSeconds(desired);
|
||||
|
||||
// Number of 10 ms samples we need
|
||||
//int num_samples = ceil(time_s / .01f);
|
||||
|
||||
// Doesn't matter what was asked for, always give 160 samples per 10 ms.
|
||||
int num_samples = 1;
|
||||
|
||||
MOZ_MTLOG(PR_LOG_DEBUG, "Asking for " << num_samples << "sample from Audio Conduit");
|
||||
|
||||
if (num_samples <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (num_samples--) {
|
||||
// This comparison is done in total time to avoid accumulated roundoff errors.
|
||||
while (MillisecondsToMediaTime(played_) < desired_time) {
|
||||
// TODO(ekr@rtfm.com): Is there a way to avoid mallocating here?
|
||||
nsRefPtr<SharedBuffer> samples = SharedBuffer::Create(1000);
|
||||
int samples_length;
|
||||
|
@ -870,6 +854,8 @@ NotifyPull(MediaStreamGraph* graph, StreamTime total) {
|
|||
|
||||
source_->AppendToTrack(1, // TODO(ekr@rtfm.com): Track ID
|
||||
&segment);
|
||||
|
||||
played_ += 10;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ class MediaPipelineReceiveAudio : public MediaPipelineReceive {
|
|||
private:
|
||||
SourceMediaStream *source_;
|
||||
RefPtr<MediaSessionConduit> conduit_;
|
||||
StreamTime played_;
|
||||
uint64_t played_; // Amount of media played in milliseconds.
|
||||
};
|
||||
|
||||
RefPtr<PipelineListener> listener_;
|
||||
|
|
Загрузка…
Ссылка в новой задаче