完成H265支持以及mp3格式支持

This commit is contained in:
langhuihui
2020-02-24 23:21:00 +08:00
parent 620d96b39c
commit 1ac06ef252
5 changed files with 30 additions and 26 deletions

File diff suppressed because one or more lines are too long

View File

@@ -155,7 +155,7 @@ Jessibuca.prototype.initAudioPlay = function (frameCount, samplerate, channels)
var _this = this
var playNextBuffer = function () {
isPlaying = false;
console.log("~", audioBuffers.length)
//console.log("~", audioBuffers.length)
if (audioBuffers.length) {
playAudio(audioBuffers.shift());
}
@@ -184,7 +184,7 @@ Jessibuca.prototype.initAudioPlay = function (frameCount, samplerate, channels)
var playAudio = function (fromBuffer) {
if (isPlaying) {
audioBuffers.push(fromBuffer);
console.log(audioBuffers.length)
//console.log(audioBuffers.length)
return;
}
isPlaying = true;

View File

@@ -5,6 +5,7 @@
</template>
<script>
import StartTime from "./StartTime"
export default {
props: {
data: Array
@@ -23,7 +24,7 @@ export default {
{
title: "订阅时间",
render(h, { row }) {
return h("StartTime", {
return h(StartTime, {
props: {
value: row.SubscribeTime
}

View File

@@ -54,8 +54,8 @@
:type="hardDiskStatus"
>磁盘使用{{networkFormat(HardDisk.Used,"M")}} 占比{{HardDisk.Usage.toFixed(2)}}%</Alert>
</div>
<Jessibuca ref="jessibuca" v-model="showPreview"></Jessibuca>
<Subscribers :data="currentStream && currentStream.SubscriberInfo" v-model="showSubscribers" />
<Jessibuca ref="jessibuca" v-model="showPreview" :videoCodec="currentStream && CodecID(currentStream.VideoInfo.CodecID)" :audioCodec="currentStream && SoundFormat(currentStream.AudioInfo.SoundFormat)"></Jessibuca>
<Subscribers :data="currentStream && currentStream.SubscriberInfo || []" v-model="showSubscribers" />
</div>
</template>
@@ -116,7 +116,7 @@ export default {
showPreview: false,
showSubscribers: false,
currentTab: "",
currentStream: [],
currentStream: null,
typeMap: {
Receiver: "📡",
FlvFile: "🎥",
@@ -181,10 +181,7 @@ export default {
return item.SubscriberInfo ? item.SubscriberInfo.length : 0;
},
preview(item) {
this.$refs.jessibuca.videoCodec = this.CodecID(item.VideoInfo.CodecID);
this.$refs.jessibuca.audioCodec = this.SoundFormat(
item.AudioInfo.SoundFormat
);
this.currentStream = item;
this.$nextTick(() =>
this.$refs.jessibuca.play(
"ws://" + location.hostname + ":8080/" + item.StreamPath

View File

@@ -202,6 +202,9 @@ func (r *Room) PushAudio(audio *avformat.AVPacket) {
}
func (r *Room) setH264Info(video *avformat.AVPacket) {
r.VideoTag = video
if r.VideoInfo.CodecID != 7 {
return
}
info := avformat.AVCDecoderConfigurationRecord{}
//0:codec,1:IsAVCSequence,2~4:compositionTime
if _, err := info.Unmarshal(video.Payload[5:]); err == nil {