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-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
|
||||
|
||||
#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) {
|
||||
DCHECK_EQ(stream_id, 0u);
|
||||
if (sample_duration_ == 0) {
|
||||
sample_duration_ = sample.duration() * kTsTimescale / streams().front()->time_scale();
|
||||
if (muxer_listener())
|
||||
muxer_listener()->OnSampleDurationReady(sample_duration_);
|
||||
if (num_samples_ < 2) {
|
||||
sample_durations_[num_samples_] = sample.duration() * kTsTimescale /
|
||||
streams().front()->time_scale();
|
||||
if (num_samples_ == 1 && muxer_listener())
|
||||
muxer_listener()->OnSampleDurationReady(sample_durations_[num_samples_]);
|
||||
num_samples_++;
|
||||
}
|
||||
return segmenter_->AddSample(sample);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ class TsMuxer : public Muxer {
|
|||
void FireOnMediaEndEvent();
|
||||
|
||||
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);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue