mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 837523 - Additional checks for unsupported app behavior r=ehugg
This commit is contained in:
parent
d66ee68167
commit
85c5ad8da6
@ -239,7 +239,9 @@ PeerConnectionImpl::PeerConnectionImpl()
|
||||
, mWindow(NULL)
|
||||
, mIdentity(NULL)
|
||||
, mSTSThread(NULL)
|
||||
, mMedia(new PeerConnectionMedia(this)) {
|
||||
, mMedia(new PeerConnectionMedia(this))
|
||||
, mNumAudioStreams(0)
|
||||
, mNumVideoStreams(0) {
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
#endif
|
||||
@ -959,21 +961,48 @@ NS_IMETHODIMP
|
||||
PeerConnectionImpl::AddStream(nsIDOMMediaStream* aMediaStream) {
|
||||
PC_AUTO_ENTER_API_CALL(true);
|
||||
|
||||
if (!aMediaStream) {
|
||||
CSFLogError(logTag, "%s: Attempt to add null stream",__FUNCTION__);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
DOMMediaStream* stream = static_cast<DOMMediaStream*>(aMediaStream);
|
||||
uint32_t hints = stream->GetHintContents();
|
||||
|
||||
// XXX Remove this check once addStream has an error callback
|
||||
// available and/or we have plumbing to handle multiple
|
||||
// local audio streams.
|
||||
if ((hints & DOMMediaStream::HINT_CONTENTS_AUDIO) &&
|
||||
mNumAudioStreams > 0) {
|
||||
CSFLogError(logTag, "%s: Only one local audio stream is supported for now",
|
||||
__FUNCTION__);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// XXX Remove this check once addStream has an error callback
|
||||
// available and/or we have plumbing to handle multiple
|
||||
// local video streams.
|
||||
if ((hints & DOMMediaStream::HINT_CONTENTS_VIDEO) &&
|
||||
mNumVideoStreams > 0) {
|
||||
CSFLogError(logTag, "%s: Only one local video stream is supported for now",
|
||||
__FUNCTION__);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
uint32_t stream_id;
|
||||
nsresult res = mMedia->AddStream(aMediaStream, &stream_id);
|
||||
if (NS_FAILED(res))
|
||||
return res;
|
||||
|
||||
DOMMediaStream* stream = static_cast<DOMMediaStream*>(aMediaStream);
|
||||
uint32_t hints = stream->GetHintContents();
|
||||
|
||||
// TODO(ekr@rtfm.com): these integers should be the track IDs
|
||||
if (hints & DOMMediaStream::HINT_CONTENTS_AUDIO) {
|
||||
mCall->addStream(stream_id, 0, AUDIO);
|
||||
mNumAudioStreams++;
|
||||
}
|
||||
|
||||
if (hints & DOMMediaStream::HINT_CONTENTS_VIDEO) {
|
||||
mCall->addStream(stream_id, 1, VIDEO);
|
||||
mNumVideoStreams++;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -994,10 +1023,14 @@ PeerConnectionImpl::RemoveStream(nsIDOMMediaStream* aMediaStream) {
|
||||
|
||||
if (hints & DOMMediaStream::HINT_CONTENTS_AUDIO) {
|
||||
mCall->removeStream(stream_id, 0, AUDIO);
|
||||
MOZ_ASSERT(mNumAudioStreams > 0);
|
||||
mNumAudioStreams--;
|
||||
}
|
||||
|
||||
if (hints & DOMMediaStream::HINT_CONTENTS_VIDEO) {
|
||||
mCall->removeStream(stream_id, 1, VIDEO);
|
||||
MOZ_ASSERT(mNumVideoStreams > 0);
|
||||
mNumVideoStreams--;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -306,6 +306,13 @@ private:
|
||||
|
||||
nsRefPtr<PeerConnectionMedia> mMedia;
|
||||
|
||||
// Temporary: used to prevent multiple audio streams or multiple video streams
|
||||
// in a single PC. This is tied up in the IETF discussion around proper
|
||||
// representation of multiple streams in SDP, and strongly related to
|
||||
// Bug 840728.
|
||||
int mNumAudioStreams;
|
||||
int mNumVideoStreams;
|
||||
|
||||
public:
|
||||
//these are temporary until the DataChannel Listen/Connect API is removed
|
||||
unsigned short listenPort;
|
||||
|
@ -3301,6 +3301,19 @@ fsmdef_ev_setremotedesc(sm_event_t *event) {
|
||||
return (SM_RC_END);
|
||||
}
|
||||
|
||||
// XXX We don't currently support renegotiation. If the remote SDP
|
||||
// has already been set, return an error to the application. This is
|
||||
// temporary until Bug 840728 is implemented.
|
||||
if (dcb->sdp && dcb->sdp->dest_sdp) {
|
||||
FSM_DEBUG_SM(DEB_F_PREFIX"Renegotiation not currently supported.\n",
|
||||
DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
|
||||
ui_set_remote_description(evSetRemoteDescError, line, call_id,
|
||||
dcb->caller_id.call_instance_id, strlib_empty(),
|
||||
PC_SETREMOTEDESCERROR);
|
||||
return (SM_RC_END);
|
||||
}
|
||||
|
||||
|
||||
if (dcb == NULL) {
|
||||
FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
|
||||
return SM_RC_CLEANUP;
|
||||
|
Loading…
Reference in New Issue
Block a user