Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--bug=解决连麦混流场景下codec变化导致的视频卡死 #558

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/demux/flv-demuxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class FLVDemuxer {
this._onScriptDataArrived = null;
this._onTrackMetadata = null;
this._onDataAvailable = null;
this._onSeek = null;

this._dataOffset = probeData.dataOffset;
this._firstParse = true;
Expand Down Expand Up @@ -128,6 +129,7 @@ class FLVDemuxer {
this._onScriptDataArrived = null;
this._onTrackMetadata = null;
this._onDataAvailable = null;
this._onSeek = null;
}

static probe(buffer) {
Expand Down Expand Up @@ -213,6 +215,14 @@ class FLVDemuxer {
this._onDataAvailable = callback;
}

get seek() {
return this._onSeek;
}

set seek(callback) {
this._onSeek = callback;
}

// timestamp base for output samples, must be in milliseconds
get timestampBase() {
return this._timestampBase;
Expand Down Expand Up @@ -530,6 +540,8 @@ class FLVDemuxer {

if (aacData.packetType === 0) { // AAC sequence header (AudioSpecificConfig)
if (meta.config) {
// flush stashed samples if AudioSpecificConfig is changed
this.seek && this.seek();
Log.w(this.TAG, 'Found another AudioSpecificConfig!');
}
let misc = aacData.data;
Expand Down Expand Up @@ -894,6 +906,8 @@ class FLVDemuxer {
meta.duration = this._duration;
} else {
if (typeof meta.avcc !== 'undefined') {
// flush stashed samples if AVCDecoderConfigurationRecord is changed
this.seek && this.seek();
Log.w(this.TAG, 'Found another AVCDecoderConfigurationRecord!');
}
}
Expand Down
1 change: 1 addition & 0 deletions src/remux/mp4-remuxer.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class MP4Remuxer {
bindDataSource(producer) {
producer.onDataAvailable = this.remux.bind(this);
producer.onTrackMetadata = this._onTrackMetadataReceived.bind(this);
producer.seek = this.seek.bind(this);
return this;
}

Expand Down