Add more loggings for GAPs
Fixes #474. Change-Id: I32f097c8a0e8d3381a276e6a130cb888e3ddd7f6
This commit is contained in:
parent
3ec2975e36
commit
a86a697d8d
|
@ -326,8 +326,18 @@ bool EsParserH26x::EmitFrame(int64_t access_unit_pos,
|
|||
const int64_t kArbitrarySmallDuration = 0.001 * kMpeg2Timescale; // 1ms.
|
||||
pending_sample_->set_duration(kArbitrarySmallDuration);
|
||||
} else {
|
||||
pending_sample_duration_ = media_sample->dts() - pending_sample_->dts();
|
||||
pending_sample_->set_duration(pending_sample_duration_);
|
||||
uint64_t sample_duration = media_sample->dts() - pending_sample_->dts();
|
||||
pending_sample_->set_duration(sample_duration);
|
||||
|
||||
const int kArbitraryGapScale = 10;
|
||||
if (sample_duration > kArbitraryGapScale * pending_sample_duration_) {
|
||||
LOG(WARNING) << "[MPEG-2 TS] PID " << pid() << " Possible GAP at dts "
|
||||
<< pending_sample_->dts() << " with next sample at dts "
|
||||
<< media_sample->dts() << " (difference "
|
||||
<< sample_duration << ")";
|
||||
}
|
||||
|
||||
pending_sample_duration_ = sample_duration;
|
||||
}
|
||||
emit_sample_cb_.Run(pid(), std::move(pending_sample_));
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <algorithm>
|
||||
|
||||
#include "packager/base/logging.h"
|
||||
#include "packager/base/strings/stringprintf.h"
|
||||
#include "packager/file/file.h"
|
||||
#include "packager/media/base/muxer_util.h"
|
||||
#include "packager/mpd/base/mpd_options.h"
|
||||
|
@ -358,7 +359,7 @@ void Representation::AddSegmentInfo(int64_t start_time, int64_t duration) {
|
|||
// A gap since previous.
|
||||
const int64_t kRoundingErrorGrace = 5;
|
||||
if (previous_segment_end_time + kRoundingErrorGrace < start_time) {
|
||||
LOG(WARNING) << "Found a gap of size "
|
||||
LOG(WARNING) << RepresentationAsString() << " Found a gap of size "
|
||||
<< (start_time - previous_segment_end_time)
|
||||
<< " > kRoundingErrorGrace (" << kRoundingErrorGrace
|
||||
<< "). The new segment starts at " << start_time
|
||||
|
@ -369,7 +370,8 @@ void Representation::AddSegmentInfo(int64_t start_time, int64_t duration) {
|
|||
// No overlapping segments.
|
||||
if (start_time < previous_segment_end_time - kRoundingErrorGrace) {
|
||||
LOG(WARNING)
|
||||
<< "Segments should not be overlapping. The new segment starts at "
|
||||
<< RepresentationAsString()
|
||||
<< " Segments should not be overlapping. The new segment starts at "
|
||||
<< start_time << " but the previous segment ends at "
|
||||
<< previous_segment_end_time << ".";
|
||||
}
|
||||
|
@ -504,4 +506,26 @@ std::string Representation::GetTextMimeType() const {
|
|||
return "";
|
||||
}
|
||||
|
||||
std::string Representation::RepresentationAsString() const {
|
||||
std::string s = base::StringPrintf("Representation (id=%d,", id_);
|
||||
if (media_info_.has_video_info()) {
|
||||
const MediaInfo_VideoInfo& video_info = media_info_.video_info();
|
||||
base::StringAppendF(&s, "codec='%s',width=%d,height=%d",
|
||||
video_info.codec().c_str(), video_info.width(),
|
||||
video_info.height());
|
||||
} else if (media_info_.has_audio_info()) {
|
||||
const MediaInfo_AudioInfo& audio_info = media_info_.audio_info();
|
||||
base::StringAppendF(
|
||||
&s, "codec='%s',frequency=%d,language='%s'", audio_info.codec().c_str(),
|
||||
audio_info.sampling_frequency(), audio_info.language().c_str());
|
||||
} else if (media_info_.has_text_info()) {
|
||||
const MediaInfo_TextInfo& text_info = media_info_.text_info();
|
||||
base::StringAppendF(&s, "codec='%s',language='%s'",
|
||||
text_info.codec().c_str(),
|
||||
text_info.language().c_str());
|
||||
}
|
||||
base::StringAppendF(&s, ")");
|
||||
return s;
|
||||
}
|
||||
|
||||
} // namespace shaka
|
||||
|
|
|
@ -206,6 +206,9 @@ class Representation {
|
|||
std::string GetAudioMimeType() const;
|
||||
std::string GetTextMimeType() const;
|
||||
|
||||
// Get Representation as string. For debugging.
|
||||
std::string RepresentationAsString() const;
|
||||
|
||||
// Init() checks that only one of VideoInfo, AudioInfo, or TextInfo is set. So
|
||||
// any logic using this can assume only one set.
|
||||
MediaInfo media_info_;
|
||||
|
|
Loading…
Reference in New Issue