[*] 每日优化
This commit is contained in:
@@ -287,7 +287,7 @@ public class MediaService extends Service {
|
|||||||
Log.d(MediaService.class.getSimpleName(), "当前蓝牙是否打开:" + audioManager.isBluetoothScoOn());
|
Log.d(MediaService.class.getSimpleName(), "当前蓝牙是否打开:" + audioManager.isBluetoothScoOn());
|
||||||
// Log.d(MediaService.class.getSimpleName(), "当前耳机是否打开:" + audioManager.isWiredHeadsetOn());
|
// Log.d(MediaService.class.getSimpleName(), "当前耳机是否打开:" + audioManager.isWiredHeadsetOn());
|
||||||
Log.d(MediaService.class.getSimpleName(), "当前扬声器是否打开:" + audioManager.isSpeakerphoneOn());
|
Log.d(MediaService.class.getSimpleName(), "当前扬声器是否打开:" + audioManager.isSpeakerphoneOn());
|
||||||
audioManager.setStreamVolume(AudioManager.MODE_IN_CALL, audioManager.getStreamMaxVolume(AudioManager.MODE_IN_CALL), AudioManager.FLAG_PLAY_SOUND);
|
audioManager.setStreamVolume(AudioManager.MODE_IN_CALL, audioManager.getStreamMaxVolume(AudioManager.MODE_IN_CALL) / 2 + 1, AudioManager.FLAG_PLAY_SOUND);
|
||||||
// audioManager.setStreamVolume(AudioManager.MODE_IN_COMMUNICATION, audioManager.getStreamMaxVolume(AudioManager.MODE_IN_COMMUNICATION), AudioManager.FLAG_PLAY_SOUND);
|
// audioManager.setStreamVolume(AudioManager.MODE_IN_COMMUNICATION, audioManager.getStreamMaxVolume(AudioManager.MODE_IN_COMMUNICATION), AudioManager.FLAG_PLAY_SOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,13 +6,19 @@ import com.acgist.taoyao.media.signal.ITaoyao;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 房间终端
|
* 房间终端
|
||||||
* SDK + NDK + Mediasoup实现视频房间会话
|
* SDK + NDK + Mediasoup实现视频房间
|
||||||
*
|
*
|
||||||
* @author acgist
|
* @author acgist
|
||||||
*/
|
*/
|
||||||
public class RoomClient extends Client {
|
public class RoomClient extends Client {
|
||||||
|
|
||||||
public RoomClient(String name, String clientId, ITaoyao taoyao, Handler mainHandler) {
|
/**
|
||||||
|
* @param name 终端名称
|
||||||
|
* @param clientId 终端ID
|
||||||
|
* @param taoyao 信令
|
||||||
|
* @param mainHandler MainHandler
|
||||||
|
*/
|
||||||
|
protected RoomClient(String name, String clientId, ITaoyao taoyao, Handler mainHandler) {
|
||||||
super(name, clientId, taoyao, mainHandler);
|
super(name, clientId, taoyao, mainHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,20 +83,20 @@ public class SessionClient extends Client {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param sessionId 会话ID
|
* @param sessionId 会话ID
|
||||||
* @param name 远程终端名称
|
* @param name 远程终端名称
|
||||||
* @param clientId 远程终端ID
|
* @param clientId 远程终端ID
|
||||||
* @param taoyao 信令
|
* @param taoyao 信令
|
||||||
* @param mainHandler MainHandler
|
* @param mainHandler MainHandler
|
||||||
* @param preview 是否预览视频
|
* @param preview 是否预览视频
|
||||||
* @param playAudio 是否播放音频
|
* @param playAudio 是否播放音频
|
||||||
* @param playVideo 是否播放视频
|
* @param playVideo 是否播放视频
|
||||||
* @param dataConsume 是否消费数据
|
* @param dataConsume 是否消费数据
|
||||||
* @param audioConsume 是否消费音频
|
* @param audioConsume 是否消费音频
|
||||||
* @param videoConsume 是否消费视频
|
* @param videoConsume 是否消费视频
|
||||||
* @param dataProduce 是否生产数据
|
* @param dataProduce 是否生产数据
|
||||||
* @param audioProduce 是否生产音频
|
* @param audioProduce 是否生产音频
|
||||||
* @param videoProduce 是否生产视频
|
* @param videoProduce 是否生产视频
|
||||||
* @param mediaProperties 媒体配置
|
* @param mediaProperties 媒体配置
|
||||||
* @param webrtcProperties WebRTC配置
|
* @param webrtcProperties WebRTC配置
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -795,8 +795,10 @@ class Taoyao {
|
|||||||
rtcpMux: false,
|
rtcpMux: false,
|
||||||
comedia: false
|
comedia: false
|
||||||
};
|
};
|
||||||
let videoConsumerId;
|
let audioConsumer;
|
||||||
|
let videoConsumer;
|
||||||
let audioConsumerId;
|
let audioConsumerId;
|
||||||
|
let videoConsumerId;
|
||||||
let audioTransportId;
|
let audioTransportId;
|
||||||
let videoTransportId;
|
let videoTransportId;
|
||||||
let audioRtpParameters;
|
let audioRtpParameters;
|
||||||
@@ -816,14 +818,13 @@ class Taoyao {
|
|||||||
port : audioPort,
|
port : audioPort,
|
||||||
rtcpPort: audioPort
|
rtcpPort: audioPort
|
||||||
});
|
});
|
||||||
const audioConsumer = await audioTransport.consume({
|
audioConsumer = await audioTransport.consume({
|
||||||
producerId: audioProducerId,
|
producerId: audioProducerId,
|
||||||
rtpCapabilities,
|
rtpCapabilities,
|
||||||
paused: true
|
paused: true
|
||||||
});
|
});
|
||||||
audioConsumerId = audioConsumer.id;
|
audioConsumerId = audioConsumer.id;
|
||||||
audioRtpParameters = audioConsumer.rtpParameters;
|
audioRtpParameters = audioConsumer.rtpParameters;
|
||||||
await audioConsumer.resume();
|
|
||||||
audioConsumer.clientId = clientId;
|
audioConsumer.clientId = clientId;
|
||||||
audioConsumer.streamId = audioStreamId;
|
audioConsumer.streamId = audioStreamId;
|
||||||
room.consumers.set(audioConsumer.id, audioConsumer);
|
room.consumers.set(audioConsumer.id, audioConsumer);
|
||||||
@@ -848,14 +849,13 @@ class Taoyao {
|
|||||||
port : videoPort,
|
port : videoPort,
|
||||||
rtcpPort: videoPort
|
rtcpPort: videoPort
|
||||||
});
|
});
|
||||||
const videoConsumer = await videoTransport.consume({
|
videoConsumer = await videoTransport.consume({
|
||||||
producerId: videoProducerId,
|
producerId: videoProducerId,
|
||||||
rtpCapabilities,
|
rtpCapabilities,
|
||||||
paused: true
|
paused: true
|
||||||
});
|
});
|
||||||
videoConsumerId = videoConsumer.id;
|
videoConsumerId = videoConsumer.id;
|
||||||
videoRtpParameters = videoConsumer.rtpParameters;
|
videoRtpParameters = videoConsumer.rtpParameters;
|
||||||
await videoConsumer.resume();
|
|
||||||
videoConsumer.clientId = clientId;
|
videoConsumer.clientId = clientId;
|
||||||
videoConsumer.streamId = videoStreamId;
|
videoConsumer.streamId = videoStreamId;
|
||||||
room.consumers.set(videoConsumer.id, videoConsumer);
|
room.consumers.set(videoConsumer.id, videoConsumer);
|
||||||
@@ -865,6 +865,12 @@ class Taoyao {
|
|||||||
});
|
});
|
||||||
console.log("controlServerRecord video:", videoTransportId, videoConsumerId, videoTransport.tuple, videoRtpParameters);
|
console.log("controlServerRecord video:", videoTransportId, videoConsumerId, videoTransport.tuple, videoRtpParameters);
|
||||||
}
|
}
|
||||||
|
if(audioConsumer) {
|
||||||
|
await audioConsumer.resume();
|
||||||
|
}
|
||||||
|
if(videoConsumer) {
|
||||||
|
await videoConsumer.resume();
|
||||||
|
}
|
||||||
message.body = {
|
message.body = {
|
||||||
roomId : roomId,
|
roomId : roomId,
|
||||||
audioConsumerId : audioConsumerId,
|
audioConsumerId : audioConsumerId,
|
||||||
|
|||||||
@@ -238,6 +238,7 @@ taoyao:
|
|||||||
m=video %d RTP/AVP 101
|
m=video %d RTP/AVP 101
|
||||||
c=IN IP4 127.0.0.1
|
c=IN IP4 127.0.0.1
|
||||||
a=rtpmap:101 VP8/90000
|
a=rtpmap:101 VP8/90000
|
||||||
|
# a=fmtp:101 packetization-mode=1
|
||||||
# 录像命令
|
# 录像命令
|
||||||
record: ffmpeg -protocol_whitelist "file,rtp,udp" -y -i %s %s
|
record: ffmpeg -protocol_whitelist "file,rtp,udp" -y -i %s %s
|
||||||
# 预览命令
|
# 预览命令
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class RtpTest {
|
public class RtpTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testSocket() throws Exception {
|
void testSocket() throws Exception {
|
||||||
final Socket socket = new Socket();
|
final Socket socket = new Socket();
|
||||||
@@ -82,6 +82,10 @@ public class RtpTest {
|
|||||||
// {"header":{"v":"1.0.0","id":1215310510002009,"signal":"room::enter"},"body":{"roomId":"8260e615-3081-4bfc-96a8-574f4dd780d9"}}
|
// {"header":{"v":"1.0.0","id":1215310510002009,"signal":"room::enter"},"body":{"roomId":"8260e615-3081-4bfc-96a8-574f4dd780d9"}}
|
||||||
// {"header":{"v":"1.0.0","id":1215310510002010,"signal":"media::transport::plain"},"body":{"roomId":"8260e615-3081-4bfc-96a8-574f4dd780d9","rtcpMux":false,"comedia":true}}
|
// {"header":{"v":"1.0.0","id":1215310510002010,"signal":"media::transport::plain"},"body":{"roomId":"8260e615-3081-4bfc-96a8-574f4dd780d9","rtcpMux":false,"comedia":true}}
|
||||||
// {"header":{"v":"1.0.0","id":1215375110006012,"signal":"media::produce"},"body":{"kind":"video","roomId":"8260e615-3081-4bfc-96a8-574f4dd780d9","transportId":"14dc9307-bf9c-4442-a9ad-ce6a97623ef4","appData":{},"rtpParameters":{"codecs":[{"mimeType":"video/vp8","clockRate":90000,"payloadType":102,"rtcpFeedback":[]}],"encodings":[{"ssrc":123123}]}}}
|
// {"header":{"v":"1.0.0","id":1215375110006012,"signal":"media::produce"},"body":{"kind":"video","roomId":"8260e615-3081-4bfc-96a8-574f4dd780d9","transportId":"14dc9307-bf9c-4442-a9ad-ce6a97623ef4","appData":{},"rtpParameters":{"codecs":[{"mimeType":"video/vp8","clockRate":90000,"payloadType":102,"rtcpFeedback":[]}],"encodings":[{"ssrc":123123}]}}}
|
||||||
|
// 音频转为PCM
|
||||||
|
// ffmpeg.exe -i .\a.m4a -f s16le a.pcm
|
||||||
|
// ffmpeg.exe -i .\a.m4a -f s16le -ac 2 -ar 8000 a.pcm
|
||||||
|
// ffplay.exe -ar 48000 -ac 2 -f s16le -i a.pcm
|
||||||
// ffmpeg不支持rtcpMux
|
// ffmpeg不支持rtcpMux
|
||||||
// ffmpeg -re -i video.mp4 -c:v vp8 -map 0:0 -f tee "[select=v:f=rtp:ssrc=123123:payload_type=102]rtp://192.168.1.110:40793?rtcpport=47218"
|
// ffmpeg -re -i video.mp4 -c:v vp8 -map 0:0 -f tee "[select=v:f=rtp:ssrc=123123:payload_type=102]rtp://192.168.1.110:40793?rtcpport=47218"
|
||||||
// ffmpeg -re -i video.mp4 -c:v libvpx -map 0:0 -f tee "[select=v:f=rtp:ssrc=123123:payload_type=102]rtp://192.168.1.110:40793?rtcpport=47218"
|
// ffmpeg -re -i video.mp4 -c:v libvpx -map 0:0 -f tee "[select=v:f=rtp:ssrc=123123:payload_type=102]rtp://192.168.1.110:40793?rtcpport=47218"
|
||||||
|
|||||||
Reference in New Issue
Block a user