This problem can be solved by refreshing page several times.And I’ve checked the producer and consumer info. When it occurs
case 1: producer icestate is “new” not “finished” nor “completed”
case 2: consumer can not consume any data (sometimes no audio && video, no video but audio)
I’ve checked the server side logging and found some hints may help to diagnose this issue:
mediasoup:Consumer constructor() +239ms
mediasoup-demo-server:Room WebRtcTransport "sctpstatechange" event [sctpState:connecting] +112ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +486ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +1ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +2ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +3ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +2ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:Consumer resume() +135ms
mediasoup:Channel request() [method:consumer.resume, id:276] +135ms
mediasoup:Channel request succeeded [method:consumer.resume, id:276] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +75ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +1ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +1ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:Consumer resume() +115ms
mediasoup:Channel request() [method:consumer.resume, id:277] +115ms
mediasoup:Channel request succeeded [method:consumer.resume, id:277] +1ms
mediasoup-demo-server:Room producer "videoorientationchange" event [producerId:f9bedcde-b135-4d4f-b024-86b41e46c880, videoOrientation:{ camera: false, flip: false, rotation: 0 }] +148ms
mediasoup-demo-server:Room protoo Peer "request" event [method:produceData, peerId:n2pc8lre] +2ms
mediasoup:Transport produceData() +259ms
mediasoup:Channel request() [method:transport.produceData, id:278] +6ms
mediasoup:Channel request succeeded [method:transport.produceData, id:278] +1ms
mediasoup:DataProducer constructor() +1s
mediasoup:Transport consumeData() +1ms
mediasoup:Channel request() [method:transport.consumeData, id:279] +0ms
mediasoup:Channel request succeeded [method:transport.consumeData, id:279] +0ms
mediasoup:DataConsumer constructor() +618ms
mediasoup-demo-server:Room WebRtcTransport "sctpstatechange" event [sctpState:connected] +6ms
mediasoup:Consumer resume() +16ms
mediasoup:Channel request() [method:consumer.resume, id:280] +8ms
mediasoup:Channel request succeeded [method:consumer.resume, id:280] +0ms
mediasoup-demo-server:Room protoo Peer "request" event [method:produceData, peerId:n2pc8lre] +33ms
mediasoup:Transport produceData() +38ms
mediasoup:Channel request() [method:transport.produceData, id:281] +30ms
mediasoup:Channel request succeeded [method:transport.produceData, id:281] +0ms
mediasoup:DataProducer constructor() +38ms
mediasoup:Transport consumeData() +0ms
mediasoup:Channel request() [method:transport.consumeData, id:282] +0ms
mediasoup:Channel request succeeded [method:transport.consumeData, id:282] +1ms
mediasoup:DataConsumer constructor() +39ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +330ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +1ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +5ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +1ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +5ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +6ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
mediasoup:WARN:Channel [pid:20819] RTC::Transport::ReceiveRtpPacket() | no suitable Producer for received RTP packet [ssrc:2657625553, payloadType:97] +0ms
I’ve checked the source code in Room.js the _createConsumer function:
async _createConsumer({ consumerPeer, producerPeer, producer })
{
// Optimization:
// - Create the server-side Consumer in paused mode.
// - Tell its Peer about it and wait for its response.
// - Upon receipt of the response, resume the server-side Consumer.
// - If video, this will mean a single key frame requested by the
// server-side Consumer (when resuming it).
// - If audio (or video), it will avoid that RTP packets are received by the
// remote endpoint *before* the Consumer is locally created in the endpoint
// (and before the local SDP O/A procedure ends). If that happens (RTP
// packets are received before the SDP O/A is done) the PeerConnection may
// fail to associate the RTP stream.
// NOTE: Don't create the Consumer if the remote Peer cannot consume it.
if (
!consumerPeer.data.rtpCapabilities ||
!this._mediasoupRouter.canConsume(
{
producerId : producer.id,
rtpCapabilities : consumerPeer.data.rtpCapabilities
})
)
{
return;
}
// Must take the Transport the remote Peer is using for consuming.
const transport = Array.from(consumerPeer.data.transports.values())
.find((t) => t.appData.consuming);
// This should not happen.
if (!transport)
{
logger.warn('_createConsumer() | Transport for consuming not found');
return;
}
// Create the Consumer in paused mode.
let consumer;
try
{
consumer = await transport.consume(
{
producerId : producer.id,
rtpCapabilities : consumerPeer.data.rtpCapabilities,
paused : true
});
}
catch (error)
{
logger.warn('_createConsumer() | transport.consume():%o', error);
return;
}
// Store the Consumer into the protoo consumerPeer data Object.
consumerPeer.data.consumers.set(consumer.id, consumer);
// Set Consumer events.
consumer.on('transportclose', () =>
{
// Remove from its map.
consumerPeer.data.consumers.delete(consumer.id);
});
consumer.on('producerclose', () =>
{
// Remove from its map.
consumerPeer.data.consumers.delete(consumer.id);
consumerPeer.notify('consumerClosed', { consumerId: consumer.id })
.catch(() => {});
});
consumer.on('producerpause', () =>
{
consumerPeer.notify('consumerPaused', { consumerId: consumer.id })
.catch(() => {});
});
consumer.on('producerresume', () =>
{
consumerPeer.notify('consumerResumed', { consumerId: consumer.id })
.catch(() => {});
});
consumer.on('score', (score) =>
{
// logger.debug(
// 'consumer "score" event [consumerId:%s, score:%o]',
// consumer.id, score);
consumerPeer.notify('consumerScore', { consumerId: consumer.id, score })
.catch(() => {});
});
consumer.on('layerschange', (layers) =>
{
consumerPeer.notify(
'consumerLayersChanged',
{
consumerId : consumer.id,
spatialLayer : layers ? layers.spatialLayer : null,
temporalLayer : layers ? layers.temporalLayer : null
})
.catch(() => {});
});
// NOTE: For testing.
// await consumer.enableTraceEvent([ 'rtp', 'keyframe', 'nack', 'pli', 'fir' ]);
// await consumer.enableTraceEvent([ 'pli', 'fir' ]);
// await consumer.enableTraceEvent([ 'keyframe' ]);
consumer.on('trace', (trace) =>
{
logger.debug(
'consumer "trace" event [producerId:%s, trace.type:%s, trace:%o]',
consumer.id, trace.type, trace);
});
// Send a protoo request to the remote Peer with Consumer parameters.
try
{
await consumerPeer.request(
'newConsumer',
{
peerId : producerPeer.id,
producerId : producer.id,
id : consumer.id,
kind : consumer.kind,
rtpParameters : consumer.rtpParameters,
type : consumer.type,
appData : producer.appData,
producerPaused : consumer.producerPaused
});
// Now that we got the positive response from the remote endpoint, resume
// the Consumer so the remote endpoint will receive the a first RTP packet
// of this new stream once its PeerConnection is already ready to process
// and associate it.
await consumer.resume();
consumerPeer.notify(
'consumerScore',
{
consumerId : consumer.id,
score : consumer.score
})
.catch(() => {});
}
catch (error)
{
logger.warn('_createConsumer() | failed:%o', error);
}
}
// NOTE: Don’t create the Consumer if the remote Peer cannot consume it.
Those lines of code would return directly without any logging, I don’t know any more details about the logic, maybe all the information above can help diagnose this issue and fix it.