Don't Output Empty Text Samples
Only output text samples to webvtt text output when they have a payload. Change-Id: I958d2b4f087209f540fa32cef002cd2cef37c65c
This commit is contained in:
parent
e1df680392
commit
113a7d123b
|
@ -3,6 +3,3 @@ WEBVTT
|
||||||
00:00:00.000 --> 00:00:00.800
|
00:00:00.000 --> 00:00:00.800
|
||||||
Yup, that's a bear, eh.
|
Yup, that's a bear, eh.
|
||||||
|
|
||||||
00:00:00.800 --> 00:00:01.000
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@ void WebVttOutputHandler::WriteCue(const std::string& id,
|
||||||
uint64_t end_ms,
|
uint64_t end_ms,
|
||||||
const std::string& settings,
|
const std::string& settings,
|
||||||
const std::string& payload) {
|
const std::string& payload) {
|
||||||
|
DCHECK_GT(payload.size(), 0u);
|
||||||
|
|
||||||
// Build a block of text that makes up the cue so that we can use a loop to
|
// Build a block of text that makes up the cue so that we can use a loop to
|
||||||
// write all the lines.
|
// write all the lines.
|
||||||
const std::string start = MsToWebVttTimestamp(start_ms);
|
const std::string start = MsToWebVttTimestamp(start_ms);
|
||||||
|
@ -148,7 +150,11 @@ Status WebVttSegmentedOutputHandler::OnTextSample(const TextSample& sample) {
|
||||||
const std::string& settings = sample.settings();
|
const std::string& settings = sample.settings();
|
||||||
const std::string& payload = sample.payload();
|
const std::string& payload = sample.payload();
|
||||||
|
|
||||||
|
// Only write cues that have payloads. Cue without payloads won't present
|
||||||
|
// any information to the user.
|
||||||
|
if (payload.size()) {
|
||||||
WriteCue(id, start_ms, end_ms, settings, payload);
|
WriteCue(id, start_ms, end_ms, settings, payload);
|
||||||
|
}
|
||||||
return Status::OK;
|
return Status::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue