diff --git a/packager/media/formats/webm/segmenter.cc b/packager/media/formats/webm/segmenter.cc index 6715c104f0..6adb114005 100644 --- a/packager/media/formats/webm/segmenter.cc +++ b/packager/media/formats/webm/segmenter.cc @@ -410,9 +410,13 @@ Status Segmenter::WriteFrame(bool write_duration) { if (cluster_->GetRelativeTimecode(NsToWebMTimecode( frame.timestamp(), cluster_->timecode_scale())) < 0) { const double segment_duration = - static_cast(frame.timestamp()) / kSecondsToNs; + static_cast(frame.timestamp() - + WebMTimecodeToNs(cluster_->timecode(), + cluster_->timecode_scale())) / + kSecondsToNs; LOG(ERROR) << "Error adding sample to segment: segment too large, " - << segment_duration << " seconds."; + << segment_duration + << " seconds. Please check your GOP size and segment duration."; return Status(error::MUXER_FAILURE, "Error adding sample to segment: segment too large"); }