ethand91 / mediasoup-ios-client

Mediasoup 3 iOS Client
ISC License
131 stars 65 forks source link

RTCMediaStreamTrack into webrtc: : MediaStreamTrackInterface error #79

Closed 435129214 closed 4 years ago

435129214 commented 4 years ago

I'm in the process of converting this project to a MAC version, but I have a problem。 in SendTransport.mm -(Producer )produce:(id)listener track:(RTCMediaStreamTrack )track encodings:(NSArray )encodings codecOptions:(NSString )codecOptions appData:(NSString *)appData { NSUInteger nativeTrack = track.hash;

NSLog(@"kind:%@:%lud",track.kind);//video

Producer *producer = [TransportWrapper nativeProduce:self._nativeTransport listener:listener track:nativeTrack encodings:encodings codecOptions:codecOptions appData:appData];

return producer;

}

but in TransportWrapper.mm +(::Producer )nativeProduce:(NSValue )nativeTransport listener:(id)listener track:(NSUInteger)mediaTrack encodings:(NSArray )encodings codecOptions:(NSString )codecOptions appData:(NSString )appData auto mediaStreamTrack = reinterpret_cast<webrtc::MediaStreamTrackInterface >(mediaTrack);

NSLog(@"1111kind:%s",mediaStreamTrack->kind().c_str());// ideo

Kind went from video to IDEO, which is wrong. At the same time, I found that the output conversion of audio fails and crashes directly.

Is there a better way to do this type conversion? Thank you very much.

435129214 commented 4 years ago

The source code here should not be the latest, I think it has different contents from the header file in the framework of another project, so I think the code is not the latest, could you please upload the latest code for my reference? Thank you!

435129214 commented 4 years ago

The source code here should not be the latest, I think it has different contents from the header file in the framework of another project, so I think the code is not the latest, could you please upload the latest code for my reference? Thank you

ethand91 commented 4 years ago

When you talk about latest do you mean the libwebrtc source? If so it cannot be updated unless libmediasoup updates it's libwebrtc version. I made this for using it on iPhone, I have no idea how you can port it to MAC

435129214 commented 4 years ago

When you talk about latest do you mean the libwebrtc source? If so it cannot be updated unless libmediasoup updates it's libwebrtc version. I made this for using it on iPhone, I have no idea how you can port it to MAC

That problem was solved, the main reason is that the two class libraries do not correspond to each other, and there was no problem after the match. Your wrapper is also pretty much available under MAC, thank you very much. But now there is a question want to ask you for help, is destopCapturer this, I also want to into the oc, then can debug in the swift, but limited ability to don't know how to adapt, can help me translate this code, please? Can give appropriate reward, thank you.