Return status instead of CHECKing in event log parser.
This CL adds ParseStatus/ParseStatusOr classes and returns those instead of CHECKing that the log is well formed. Some refactoring was required. We also add a allow_incomplete_logs parameter to the parser which by default is false. Setting it to true will make the parser log a warning but return success for errors that typically indicate that the log has been truncated. "Deeper" errors indicating log corruption still return an error. Bug: webrtc:11064 Change-Id: Id5bd6e321de07e250662ae3aaa5ef15f48db6d55 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158746 Reviewed-by: Ivo Creusen <ivoc@webrtc.org> Reviewed-by: Sebastian Jansson <srte@webrtc.org> Commit-Queue: Björn Terelius <terelius@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29679}
This commit is contained in:
committed by
Commit Bot
parent
cc9bf6398c
commit
a06048a41e
@ -258,7 +258,7 @@ void RtcEventLogSession::WriteVideoRecvConfigs(size_t video_recv_streams,
|
||||
|
||||
clock_.AdvanceTime(TimeDelta::ms(prng_.Rand(20)));
|
||||
uint32_t ssrc = prng_.Rand<uint32_t>();
|
||||
incoming_extensions_.emplace_back(prng_.Rand<uint32_t>(), all_extensions);
|
||||
incoming_extensions_.emplace_back(ssrc, all_extensions);
|
||||
auto event = gen_.NewVideoReceiveStreamConfig(ssrc, all_extensions);
|
||||
event_log->Log(event->Copy());
|
||||
video_recv_config_list_.push_back(std::move(event));
|
||||
@ -287,7 +287,7 @@ void RtcEventLogSession::WriteVideoSendConfigs(size_t video_send_streams,
|
||||
|
||||
clock_.AdvanceTime(TimeDelta::ms(prng_.Rand(20)));
|
||||
uint32_t ssrc = prng_.Rand<uint32_t>();
|
||||
outgoing_extensions_.emplace_back(prng_.Rand<uint32_t>(), all_extensions);
|
||||
outgoing_extensions_.emplace_back(ssrc, all_extensions);
|
||||
auto event = gen_.NewVideoSendStreamConfig(ssrc, all_extensions);
|
||||
event_log->Log(event->Copy());
|
||||
video_send_config_list_.push_back(std::move(event));
|
||||
@ -545,7 +545,7 @@ void RtcEventLogSession::WriteLog(EventCounts count,
|
||||
void RtcEventLogSession::ReadAndVerifyLog() {
|
||||
// Read the generated file from disk.
|
||||
ParsedRtcEventLog parsed_log;
|
||||
ASSERT_TRUE(parsed_log.ParseFile(temp_filename_));
|
||||
ASSERT_TRUE(parsed_log.ParseFile(temp_filename_).ok());
|
||||
|
||||
// Start and stop events.
|
||||
auto& parsed_start_log_events = parsed_log.start_log_events();
|
||||
@ -875,7 +875,7 @@ TEST_P(RtcEventLogCircularBufferTest, KeepsMostRecentEvents) {
|
||||
|
||||
// Read the generated file from disk.
|
||||
ParsedRtcEventLog parsed_log;
|
||||
ASSERT_TRUE(parsed_log.ParseFile(temp_filename));
|
||||
ASSERT_TRUE(parsed_log.ParseFile(temp_filename).ok());
|
||||
|
||||
const auto& start_log_events = parsed_log.start_log_events();
|
||||
ASSERT_EQ(start_log_events.size(), 1u);
|
||||
|
||||
Reference in New Issue
Block a user