Exemplo n.º 1
0
void
AudioNodeStream::FinishOutput()
{
  StreamBuffer::Track* track = EnsureTrack(AUDIO_TRACK);
  track->SetEnded();

  for (uint32_t j = 0; j < mListeners.Length(); ++j) {
    MediaStreamListener* l = mListeners[j];
    AudioSegment emptySegment;
    l->NotifyQueuedTrackChanges(Graph(), AUDIO_TRACK,
                                track->GetSegment()->GetDuration(),
                                MediaStreamListener::TRACK_EVENT_ENDED, emptySegment);
  }
}
Exemplo n.º 2
0
 void TrackUnionStream::EndTrack(uint32_t aIndex)
 {
   StreamBuffer::Track* outputTrack = mBuffer.FindTrack(mTrackMap[aIndex].mOutputTrackID);
   if (!outputTrack || outputTrack->IsEnded())
     return;
   for (uint32_t j = 0; j < mListeners.Length(); ++j) {
     MediaStreamListener* l = mListeners[j];
     StreamTime offset = outputTrack->GetSegment()->GetDuration();
     nsAutoPtr<MediaSegment> segment;
     segment = outputTrack->GetSegment()->CreateEmptyClone();
     l->NotifyQueuedTrackChanges(Graph(), outputTrack->GetID(), offset,
                                 MediaStreamListener::TRACK_EVENT_ENDED,
                                 *segment);
   }
   outputTrack->SetEnded();
 }
void
AudioNodeStream::FinishOutput()
{
  if (IsFinishedOnGraphThread()) {
    return;
  }

  StreamBuffer::Track* track = EnsureTrack();
  track->SetEnded();
  FinishOnGraphThread();

  for (uint32_t j = 0; j < mListeners.Length(); ++j) {
    MediaStreamListener* l = mListeners[j];
    AudioSegment emptySegment;
    l->NotifyQueuedTrackChanges(Graph(), AUDIO_NODE_STREAM_TRACK_ID,
                                IdealAudioRate(),
                                track->GetSegment()->GetDuration(),
                                MediaStreamListener::TRACK_EVENT_ENDED, emptySegment);
  }
}
Exemplo n.º 4
0
void TrackUnionStream::EndTrack(uint32_t aIndex)
{
    StreamBuffer::Track* outputTrack = mBuffer.FindTrack(mTrackMap[aIndex].mOutputTrackID);
    if (!outputTrack || outputTrack->IsEnded())
        return;
    STREAM_LOG(LogLevel::Debug, ("TrackUnionStream %p ending track %d", this, outputTrack->GetID()));
    for (uint32_t j = 0; j < mListeners.Length(); ++j) {
        MediaStreamListener* l = mListeners[j];
        StreamTime offset = outputTrack->GetSegment()->GetDuration();
        nsAutoPtr<MediaSegment> segment;
        segment = outputTrack->GetSegment()->CreateEmptyClone();
        l->NotifyQueuedTrackChanges(Graph(), outputTrack->GetID(), offset,
                                    MediaStreamListener::TRACK_EVENT_ENDED,
                                    *segment,
                                    mTrackMap[aIndex].mInputPort->GetSource(),
                                    mTrackMap[aIndex].mInputTrackID);
    }
    for (TrackBound<MediaStreamTrackListener>& b : mTrackListeners) {
        if (b.mTrackID == outputTrack->GetID()) {
            b.mListener->NotifyEnded();
        }
    }
    outputTrack->SetEnded();
}