Skip to content

Commit

Permalink
Merge branch 'refactor-live' of https://github.com/bytedance/xgplayer
Browse files Browse the repository at this point in the history
…into refactor-live-loaderbuffer
  • Loading branch information
yqjiang committed Sep 19, 2019
2 parents 343cfbb + 936d929 commit 5bf5a8b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions packages/xgplayer-flv/src/parse/demux/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ class FlvDemuxer {
audioMedia.sampleRateIndex = aacHeader.audioSampleRateIndex

if (this._hasScript && !this._hasAudioSequence && (!this.tracks.videoTrack || this._hasVideoSequence)) {
this.emit(DEMUX_EVENTS.METADATA_PARSED)
this.emit(DEMUX_EVENTS.METADATA_PARSED, 'audio')
} else if (this._hasScript && this._hasAudioSequence) {
this.emit(DEMUX_EVENTS.AUDIO_METADATA_CHANGE)
}
Expand Down Expand Up @@ -399,13 +399,13 @@ class FlvDemuxer {
nalu.data = chunk.data.slice(Number.parseInt(r), nalu.size + r)
r += nalu.size
this.tracks.videoTrack.samples.push(nalu)
this.emit(DEMUX_EVENTS.METADATA_PARSED)
this.emit(DEMUX_EVENTS.METADATA_PARSED, 'video')
}
} else if (Number.parseInt(chunk.avcPacketType) === 0) {
if (!this._datasizeValidator(chunk.datasize)) {
this.logger.warn(this.TAG, `invalid video tag datasize: ${chunk.datasize}`)
} else {
this.emit(DEMUX_EVENTS.METADATA_PARSED)
this.emit(DEMUX_EVENTS.METADATA_PARSED, 'video')
}
}
} else if (codecID === 7) {
Expand All @@ -432,7 +432,7 @@ class FlvDemuxer {
let validate = this._datasizeValidator(chunk.datasize)
if (validate) {
if (this._hasScript && !this._hasVideoSequence && (!this.tracks.audioTrack || this._hasAudioSequence)) {
this.emit(DEMUX_EVENTS.METADATA_PARSED)
this.emit(DEMUX_EVENTS.METADATA_PARSED, 'video')
} else if (this._hasScript && this._hasVideoSequence) {
this.emit(DEMUX_EVENTS.VIDEO_METADATA_CHANGE)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/xgplayer-flv/src/parse/remux/Mp4remux.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class Mp4Remuxer {

init () {
this.on(DEMUX_EVENTS.DEMUX_COMPLETE, this.remux.bind(this))
this.on(DEMUX_EVENTS.MEDIA_INFO, this.onMediaInfoReady.bind(this))
this.on(DEMUX_EVENTS.METADATA_PARSED, this.onMetaDataReady.bind(this))
}

destroy () {
Expand Down Expand Up @@ -49,7 +49,7 @@ export default class Mp4Remuxer {
this._audioSegmentList.clear()
}

onMediaInfoReady () {
onMetaDataReady (type) {
const mediaInfo = this._context.mediaInfo
if (!mediaInfo) {
this.emit(REMUX_EVENTS.REMUX_ERROR, new Error('failed to get media info'))
Expand Down
4 changes: 2 additions & 2 deletions packages/xgplayer-utils/src/models/trackSample.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export class TrackSample {
export class AudioTrackSample {
constructor (info) {
let _default = TrackSample.getDefault()
let _default = AudioTrackSample.getDefault()
if (!info) {
return _default
}
Expand Down

0 comments on commit 5bf5a8b

Please sign in to comment.