parent
4c0d38bde3
commit
562040e000
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#EXT-X-MEDIA:TYPE=AUDIO,URI="bear-640x360-ec3-audio.m3u8",GROUP-ID="default-audio-group",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2"
|
#EXT-X-MEDIA:TYPE=AUDIO,URI="bear-640x360-ec3-audio.m3u8",GROUP-ID="default-audio-group",NAME="stream_0",AUTOSELECT=YES,CHANNELS="2"
|
||||||
|
|
||||||
#EXT-X-STREAM-INF:BANDWIDTH=1216655,AVERAGE-BANDWIDTH=1104925,CODECS="avc1.64001e,ec-3",RESOLUTION=640x360,FRAME-RATE=9.990,AUDIO="default-audio-group"
|
#EXT-X-STREAM-INF:BANDWIDTH=1216655,AVERAGE-BANDWIDTH=1104925,CODECS="avc1.64001e,ec-3",RESOLUTION=640x360,FRAME-RATE=29.970,AUDIO="default-audio-group"
|
||||||
bear-640x360-ec3-video.m3u8
|
bear-640x360-ec3-video.m3u8
|
||||||
|
|
||||||
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=217180,AVERAGE-BANDWIDTH=157213,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-ec3-video-iframe.m3u8"
|
#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=217180,AVERAGE-BANDWIDTH=157213,CODECS="avc1.64001e",RESOLUTION=640x360,URI="bear-640x360-ec3-video-iframe.m3u8"
|
||||||
|
|
|
@ -34,10 +34,12 @@ Status TsMuxer::Finalize() {
|
||||||
|
|
||||||
Status TsMuxer::AddSample(size_t stream_id, const MediaSample& sample) {
|
Status TsMuxer::AddSample(size_t stream_id, const MediaSample& sample) {
|
||||||
DCHECK_EQ(stream_id, 0u);
|
DCHECK_EQ(stream_id, 0u);
|
||||||
if (sample_duration_ == 0) {
|
if (num_samples_ < 2) {
|
||||||
sample_duration_ = sample.duration() * kTsTimescale / streams().front()->time_scale();
|
sample_durations_[num_samples_] = sample.duration() * kTsTimescale /
|
||||||
if (muxer_listener())
|
streams().front()->time_scale();
|
||||||
muxer_listener()->OnSampleDurationReady(sample_duration_);
|
if (num_samples_ == 1 && muxer_listener())
|
||||||
|
muxer_listener()->OnSampleDurationReady(sample_durations_[num_samples_]);
|
||||||
|
num_samples_++;
|
||||||
}
|
}
|
||||||
return segmenter_->AddSample(sample);
|
return segmenter_->AddSample(sample);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,8 @@ class TsMuxer : public Muxer {
|
||||||
void FireOnMediaEndEvent();
|
void FireOnMediaEndEvent();
|
||||||
|
|
||||||
std::unique_ptr<TsSegmenter> segmenter_;
|
std::unique_ptr<TsSegmenter> segmenter_;
|
||||||
int64_t sample_duration_ = 0;
|
int64_t sample_durations_[2];
|
||||||
|
int64_t num_samples_ = 0;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(TsMuxer);
|
DISALLOW_COPY_AND_ASSIGN(TsMuxer);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue