diff --git a/webrtc/call/rtc_event_log.cc b/webrtc/call/rtc_event_log.cc index 058879ae0b..97885cc066 100644 --- a/webrtc/call/rtc_event_log.cc +++ b/webrtc/call/rtc_event_log.cc @@ -174,9 +174,7 @@ void RtcEventLogImpl::StartLogging(const std::string& file_name, // Write a LOG_START event to the file. rtclog::Event start_event; start_event.set_timestamp_us(start_time_us_); - start_event.set_type(rtclog::Event::DEBUG_EVENT); - auto debug_event = start_event.mutable_debug_event(); - debug_event->set_type(rtclog::DebugEvent_EventType_LOG_START); + start_event.set_type(rtclog::Event::LOG_START); StoreToFile(&start_event); } @@ -323,23 +321,20 @@ void RtcEventLogImpl::LogAudioPlayout(uint32_t ssrc) { rtclog::Event event; const int64_t timestamp = clock_->TimeInMicroseconds(); event.set_timestamp_us(timestamp); - event.set_type(rtclog::Event::DEBUG_EVENT); - auto debug_event = event.mutable_debug_event(); - debug_event->set_type(rtclog::DebugEvent_EventType_AUDIO_PLAYOUT); - debug_event->set_local_ssrc(ssrc); + event.set_type(rtclog::Event::AUDIO_PLAYOUT_EVENT); + auto playout_event = event.mutable_audio_playout_event(); + playout_event->set_local_ssrc(ssrc); HandleEvent(&event); } void RtcEventLogImpl::StopLoggingLocked() { if (currently_logging_) { currently_logging_ = false; - // Create a LogEnd debug event + // Create a LogEnd event rtclog::Event event; int64_t timestamp = clock_->TimeInMicroseconds(); event.set_timestamp_us(timestamp); - event.set_type(rtclog::Event::DEBUG_EVENT); - auto debug_event = event.mutable_debug_event(); - debug_event->set_type(rtclog::DebugEvent_EventType_LOG_END); + event.set_type(rtclog::Event::LOG_END); // Store the event and close the file RTC_DCHECK(file_->Open()); StoreToFile(&event); diff --git a/webrtc/call/rtc_event_log.proto b/webrtc/call/rtc_event_log.proto index bdb6bb1275..6bdea7bd2f 100644 --- a/webrtc/call/rtc_event_log.proto +++ b/webrtc/call/rtc_event_log.proto @@ -29,13 +29,15 @@ message Event { // receive the new events as UNKNOWN_EVENT. enum EventType { UNKNOWN_EVENT = 0; - RTP_EVENT = 1; - RTCP_EVENT = 2; - DEBUG_EVENT = 3; - VIDEO_RECEIVER_CONFIG_EVENT = 4; - VIDEO_SENDER_CONFIG_EVENT = 5; - AUDIO_RECEIVER_CONFIG_EVENT = 6; - AUDIO_SENDER_CONFIG_EVENT = 7; + LOG_START = 1; + LOG_END = 2; + RTP_EVENT = 3; + RTCP_EVENT = 4; + AUDIO_PLAYOUT_EVENT = 5; + VIDEO_RECEIVER_CONFIG_EVENT = 6; + VIDEO_SENDER_CONFIG_EVENT = 7; + AUDIO_RECEIVER_CONFIG_EVENT = 8; + AUDIO_SENDER_CONFIG_EVENT = 9; } // required - Indicates the type of this event @@ -47,8 +49,8 @@ message Event { // optional - but required if type == RTCP_EVENT optional RtcpPacket rtcp_packet = 4; - // optional - but required if type == DEBUG_EVENT - optional DebugEvent debug_event = 5; + // optional - but required if type == AUDIO_PLAYOUT_EVENT + optional AudioPlayoutEvent audio_playout_event = 5; // optional - but required if type == VIDEO_RECEIVER_CONFIG_EVENT optional VideoReceiveConfig video_receiver_config = 6; @@ -92,22 +94,8 @@ message RtcpPacket { optional bytes packet_data = 3; } - -message DebugEvent { - // Indicates the type of the debug event. - // LOG_START and LOG_END indicate the start and end of the log respectively. - // AUDIO_PLAYOUT indicates a call to the PlayoutData10Ms() function in ACM. - enum EventType { - UNKNOWN_EVENT = 0; - LOG_START = 1; - LOG_END = 2; - AUDIO_PLAYOUT = 3; - } - - // required - optional EventType type = 1; - - // required if type == AUDIO_PLAYOUT +message AudioPlayoutEvent { + // required - The SSRC of the audio stream associated with the playout event. optional uint32 local_ssrc = 2; } @@ -222,10 +210,21 @@ message EncoderConfig { message AudioReceiveConfig { - // TODO(terelius): Add audio-receive config. + // required - Synchronization source (stream identifier) to be received. + optional uint32 remote_ssrc = 1; + + // required - Sender SSRC used for sending RTCP (such as receiver reports). + optional uint32 local_ssrc = 2; + + // RTP header extensions used for the received audio stream. + repeated RtpHeaderExtension header_extensions = 3; } message AudioSendConfig { - // TODO(terelius): Add audio-receive config. + // required - Synchronization source (stream identifier) for outgoing stream. + optional uint32 ssrc = 1; + + // RTP header extensions used for the outgoing audio stream. + repeated RtpHeaderExtension header_extensions = 2; } diff --git a/webrtc/call/rtc_event_log_unittest.cc b/webrtc/call/rtc_event_log_unittest.cc index 1e35733d2c..536b997227 100644 --- a/webrtc/call/rtc_event_log_unittest.cc +++ b/webrtc/call/rtc_event_log_unittest.cc @@ -84,10 +84,12 @@ MediaType GetRuntimeMediaType(rtclog::MediaType media_type) { return ::testing::AssertionFailure() << "Event of type " << type << " has " << (event.has_rtcp_packet() ? "" : "no ") << "RTCP packet"; - if ((type == rtclog::Event::DEBUG_EVENT) != event.has_debug_event()) + if ((type == rtclog::Event::AUDIO_PLAYOUT_EVENT) != + event.has_audio_playout_event()) return ::testing::AssertionFailure() << "Event of type " << type << " has " - << (event.has_debug_event() ? "" : "no ") << "debug event"; + << (event.has_audio_playout_event() ? "" : "no ") + << "audio_playout event"; if ((type == rtclog::Event::VIDEO_RECEIVER_CONFIG_EVENT) != event.has_video_receiver_config()) return ::testing::AssertionFailure() @@ -267,20 +269,15 @@ void VerifyRtcpEvent(const rtclog::Event& event, void VerifyPlayoutEvent(const rtclog::Event& event, uint32_t ssrc) { ASSERT_TRUE(IsValidBasicEvent(event)); - ASSERT_EQ(rtclog::Event::DEBUG_EVENT, event.type()); - const rtclog::DebugEvent& debug_event = event.debug_event(); - ASSERT_TRUE(debug_event.has_type()); - EXPECT_EQ(rtclog::DebugEvent::AUDIO_PLAYOUT, debug_event.type()); - ASSERT_TRUE(debug_event.has_local_ssrc()); - EXPECT_EQ(ssrc, debug_event.local_ssrc()); + ASSERT_EQ(rtclog::Event::AUDIO_PLAYOUT_EVENT, event.type()); + const rtclog::AudioPlayoutEvent& playout_event = event.audio_playout_event(); + ASSERT_TRUE(playout_event.has_local_ssrc()); + EXPECT_EQ(ssrc, playout_event.local_ssrc()); } void VerifyLogStartEvent(const rtclog::Event& event) { ASSERT_TRUE(IsValidBasicEvent(event)); - ASSERT_EQ(rtclog::Event::DEBUG_EVENT, event.type()); - const rtclog::DebugEvent& debug_event = event.debug_event(); - ASSERT_TRUE(debug_event.has_type()); - EXPECT_EQ(rtclog::DebugEvent::LOG_START, debug_event.type()); + EXPECT_EQ(rtclog::Event::LOG_START, event.type()); } /* @@ -399,12 +396,12 @@ void GenerateVideoSendConfig(uint32_t extensions_bitvector, // them back to see if they match. void LogSessionAndReadBack(size_t rtp_count, size_t rtcp_count, - size_t debug_count, + size_t playout_count, uint32_t extensions_bitvector, uint32_t csrcs_count, unsigned random_seed) { ASSERT_LE(rtcp_count, rtp_count); - ASSERT_LE(debug_count, rtp_count); + ASSERT_LE(playout_count, rtp_count); std::vector rtp_packets; std::vector rtcp_packets; std::vector rtp_header_sizes; @@ -429,8 +426,8 @@ void LogSessionAndReadBack(size_t rtp_count, rtcp_packets.push_back(rtc::Buffer(packet_size)); GenerateRtcpPacket(rtcp_packets[i].data(), packet_size); } - // Create debug_count random SSRCs to use when logging AudioPlayout events. - for (size_t i = 0; i < debug_count; i++) { + // Create playout_count random SSRCs to use when logging AudioPlayout events. + for (size_t i = 0; i < playout_count; i++) { playout_ssrcs.push_back(static_cast(rand())); } // Create configurations for the video streams. @@ -450,7 +447,7 @@ void LogSessionAndReadBack(size_t rtp_count, rtc::scoped_ptr log_dumper(RtcEventLog::Create()); log_dumper->LogVideoReceiveStreamConfig(receiver_config); log_dumper->LogVideoSendStreamConfig(sender_config); - size_t rtcp_index = 1, debug_index = 1; + size_t rtcp_index = 1, playout_index = 1; for (size_t i = 1; i <= rtp_count; i++) { log_dumper->LogRtpHeader( (i % 2 == 0), // Every second packet is incoming. @@ -464,9 +461,9 @@ void LogSessionAndReadBack(size_t rtp_count, rtcp_packets[rtcp_index - 1].size()); rtcp_index++; } - if (i * debug_count >= debug_index * rtp_count) { - log_dumper->LogAudioPlayout(playout_ssrcs[debug_index - 1]); - debug_index++; + if (i * playout_count >= playout_index * rtp_count) { + log_dumper->LogAudioPlayout(playout_ssrcs[playout_index - 1]); + playout_index++; } if (i == rtp_count / 2) { log_dumper->StartLogging(temp_filename, 10000000); @@ -481,11 +478,11 @@ void LogSessionAndReadBack(size_t rtp_count, // Verify the result. const int event_count = - config_count + debug_count + rtcp_count + rtp_count + 1; + config_count + playout_count + rtcp_count + rtp_count + 1; EXPECT_EQ(event_count, parsed_stream.stream_size()); VerifyReceiveStreamConfig(parsed_stream.stream(0), receiver_config); VerifySendStreamConfig(parsed_stream.stream(1), sender_config); - size_t event_index = config_count, rtcp_index = 1, debug_index = 1; + size_t event_index = config_count, rtcp_index = 1, playout_index = 1; for (size_t i = 1; i <= rtp_count; i++) { VerifyRtpEvent(parsed_stream.stream(event_index), (i % 2 == 0), // Every second packet is incoming. @@ -502,11 +499,11 @@ void LogSessionAndReadBack(size_t rtp_count, event_index++; rtcp_index++; } - if (i * debug_count >= debug_index * rtp_count) { + if (i * playout_count >= playout_index * rtp_count) { VerifyPlayoutEvent(parsed_stream.stream(event_index), - playout_ssrcs[debug_index - 1]); + playout_ssrcs[playout_index - 1]); event_index++; - debug_index++; + playout_index++; } if (i == rtp_count / 2) { VerifyLogStartEvent(parsed_stream.stream(event_index)); diff --git a/webrtc/modules/audio_coding/neteq/tools/rtc_event_log_source.cc b/webrtc/modules/audio_coding/neteq/tools/rtc_event_log_source.cc index bfd49d3cec..9b17ba8f64 100644 --- a/webrtc/modules/audio_coding/neteq/tools/rtc_event_log_source.cc +++ b/webrtc/modules/audio_coding/neteq/tools/rtc_event_log_source.cc @@ -47,16 +47,16 @@ const rtclog::RtpPacket* GetRtpPacket(const rtclog::Event& event) { return &rtp_packet; } -const rtclog::DebugEvent* GetAudioOutputEvent(const rtclog::Event& event) { - if (!event.has_type() || event.type() != rtclog::Event::DEBUG_EVENT) +const rtclog::AudioPlayoutEvent* GetAudioPlayoutEvent( + const rtclog::Event& event) { + if (!event.has_type() || event.type() != rtclog::Event::AUDIO_PLAYOUT_EVENT) return nullptr; - if (!event.has_timestamp_us() || !event.has_debug_event()) + if (!event.has_timestamp_us() || !event.has_audio_playout_event()) return nullptr; - const rtclog::DebugEvent& debug_event = event.debug_event(); - if (!debug_event.has_type() || - debug_event.type() != rtclog::DebugEvent::AUDIO_PLAYOUT) + const rtclog::AudioPlayoutEvent& playout_event = event.audio_playout_event(); + if (!playout_event.has_local_ssrc()) return nullptr; - return &debug_event; + return &playout_event; } } // namespace @@ -107,9 +107,10 @@ Packet* RtcEventLogSource::NextPacket() { int64_t RtcEventLogSource::NextAudioOutputEventMs() { while (audio_output_index_ < event_log_->stream_size()) { const rtclog::Event& event = event_log_->stream(audio_output_index_); - const rtclog::DebugEvent* debug_event = GetAudioOutputEvent(event); + const rtclog::AudioPlayoutEvent* playout_event = + GetAudioPlayoutEvent(event); audio_output_index_++; - if (debug_event) + if (playout_event) return event.timestamp_us() / 1000; } return std::numeric_limits::max();