Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with failure to create remote streams and tracks. #175

Open
ekr opened this issue Oct 8, 2014 · 0 comments
Open

Deal with failure to create remote streams and tracks. #175

ekr opened this issue Oct 8, 2014 · 0 comments

Comments

@ekr
Copy link

ekr commented Oct 8, 2014

                                               mRemoteRequestedSDP);

if (NS_FAILED(nrv)) {
Error error;
switch (nrv) {
case NS_ERROR_INVALID_ARG: error = kInvalidSessionDescription; break;
case NS_ERROR_UNEXPECTED: error = kInvalidState; break;
default: error = kInternalError;
}

std::string error_string = mJsepSession->last_error();
// appendSdpParseErrors(mSDPParseErrorMessages, &error_string, &error);
CSFLogError(logTag, "%s: pc = %s, error = %s",
            __FUNCTION__, mHandle.c_str(), error_string.c_str());
pco->OnSetRemoteDescriptionError(error, ObString(error_string.c_str()), rv);

} else {
// All the stream stuff is a mess here. We just have one stream
// but a pile of tracks.
// Step 1. Verify that we have a stream.
nsRefPtrsipcc::RemoteSourceStreamInfo info;
if (mMedia->RemoteStreamsLength() < 1) {
nsresult rv = CreateRemoteSourceStreamInfo(&info);
if (NS_FAILED(rv)) {
MOZ_CRASH(); // TODO([email protected]): How do we recover here? We don't
// want mismatches.
}

  rv = mMedia->AddRemoteStream(info);
  if (NS_FAILED(rv)) {
    MOZ_CRASH();  // TODO([email protected]): How do we recover here? We don't
                  // want mismatches.
  }
} else {
  info = mMedia->GetRemoteStream(0);
}
DOMMediaStream* stream = info->GetMediaStream();

// Step 2. Add the tracks. Unfortunately, we only can really support
// two tracks, one audio and one video.
nsresult rv;
size_t num_tracks = mJsepSession->num_remote_tracks();
MOZ_ASSERT(num_tracks <= 2);
for (size_t i = 0; i < num_tracks; ++i) {
  RefPtr<JsepMediaStreamTrack> track;
  rv = mJsepSession->remote_track(i, &track);
  if (NS_FAILED(rv)) {
    MOZ_CRASH();  // TODO([email protected]): How do we recover here? We don't
                  // want mismatches.
  }
  if (track->media_type() == mozilla::SdpMediaSection::kAudio) {
    info->mTrackTypeHints |= DOMMediaStream::HINT_CONTENTS_AUDIO;
  } else if (track->media_type() == mozilla::SdpMediaSection::kAudio) {
    info->mTrackTypeHints |= DOMMediaStream::HINT_CONTENTS_AUDIO;
  } else {
    // Data channel?
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant