Skip to content

Commit

Permalink
added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
koln67 committed Sep 11, 2020
1 parent ecbbcf2 commit 177000c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packager/media/formats/mp2t/ts_muxer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Status TsMuxer::Finalize() {

Status TsMuxer::AddSample(size_t stream_id, const MediaSample& sample) {
DCHECK_EQ(stream_id, 0u);
// The duration of the first sample may have been adjusted, so use
// the duration of the second sample instead.
if (num_samples_ < 2) {
sample_durations_[num_samples_] = sample.duration() * kTsTimescale /
streams().front()->time_scale();
Expand Down
2 changes: 2 additions & 0 deletions packager/media/formats/mp4/segmenter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ Status Segmenter::AddSample(size_t stream_id, const MediaSample& sample) {
if (!status.ok())
return status;

// The duration of the first sample may have been adjusted, so use
// the duration of the second sample instead.
if (num_samples_ < 2) {
sample_durations_[num_samples_] = sample.duration();
num_samples_++;
Expand Down
2 changes: 2 additions & 0 deletions packager/media/formats/webm/segmenter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ Status Segmenter::Finalize() {
Status Segmenter::AddSample(const MediaSample& source_sample) {
std::shared_ptr<MediaSample> sample(source_sample.Clone());

// The duration of the first sample may have been adjusted, so use
// the duration of the second sample instead.
if (num_samples_ < 2) {
sample_durations_[num_samples_] = sample->duration();
if (num_samples_ == 0)
Expand Down
2 changes: 1 addition & 1 deletion packager/media/formats/webm/segmenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class Segmenter {
uint64_t progress_target_ = 0;
uint64_t accumulated_progress_ = 0;
uint64_t first_timestamp_ = 0;
uint32_t sample_durations_[2] = {0u, 0u};
int64_t sample_durations_[2] = {0, 0};
size_t num_samples_ = 0;
// The position (in bytes) of the start of the Segment payload in the init
// file. This is also the size of the header before the SeekHead.
Expand Down

0 comments on commit 177000c

Please sign in to comment.