Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: webrtc/modules/audio_coding/neteq/tools/rtc_event_log_source.cc

Issue 1348113003: Update to the RtcEventLog protobuf to remove the DebugEvent message. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@audio_playout_timing
Patch Set: Rebase. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/call/rtc_event_log_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 29 matching lines...) Expand all
40 const rtclog::RtpPacket& rtp_packet = event.rtp_packet(); 40 const rtclog::RtpPacket& rtp_packet = event.rtp_packet();
41 if (!rtp_packet.has_type() || rtp_packet.type() != rtclog::AUDIO || 41 if (!rtp_packet.has_type() || rtp_packet.type() != rtclog::AUDIO ||
42 !rtp_packet.has_incoming() || !rtp_packet.incoming() || 42 !rtp_packet.has_incoming() || !rtp_packet.incoming() ||
43 !rtp_packet.has_packet_length() || rtp_packet.packet_length() == 0 || 43 !rtp_packet.has_packet_length() || rtp_packet.packet_length() == 0 ||
44 !rtp_packet.has_header() || rtp_packet.header().size() == 0 || 44 !rtp_packet.has_header() || rtp_packet.header().size() == 0 ||
45 rtp_packet.packet_length() < rtp_packet.header().size()) 45 rtp_packet.packet_length() < rtp_packet.header().size())
46 return nullptr; 46 return nullptr;
47 return &rtp_packet; 47 return &rtp_packet;
48 } 48 }
49 49
50 const rtclog::DebugEvent* GetAudioOutputEvent(const rtclog::Event& event) { 50 const rtclog::AudioPlayoutEvent* GetAudioPlayoutEvent(
51 if (!event.has_type() || event.type() != rtclog::Event::DEBUG_EVENT) 51 const rtclog::Event& event) {
52 if (!event.has_type() || event.type() != rtclog::Event::AUDIO_PLAYOUT_EVENT)
52 return nullptr; 53 return nullptr;
53 if (!event.has_timestamp_us() || !event.has_debug_event()) 54 if (!event.has_timestamp_us() || !event.has_audio_playout_event())
54 return nullptr; 55 return nullptr;
55 const rtclog::DebugEvent& debug_event = event.debug_event(); 56 const rtclog::AudioPlayoutEvent& playout_event = event.audio_playout_event();
56 if (!debug_event.has_type() || 57 if (!playout_event.has_local_ssrc())
57 debug_event.type() != rtclog::DebugEvent::AUDIO_PLAYOUT)
58 return nullptr; 58 return nullptr;
59 return &debug_event; 59 return &playout_event;
60 } 60 }
61 61
62 } // namespace 62 } // namespace
63 63
64 RtcEventLogSource* RtcEventLogSource::Create(const std::string& file_name) { 64 RtcEventLogSource* RtcEventLogSource::Create(const std::string& file_name) {
65 RtcEventLogSource* source = new RtcEventLogSource(); 65 RtcEventLogSource* source = new RtcEventLogSource();
66 RTC_CHECK(source->OpenFile(file_name)); 66 RTC_CHECK(source->OpenFile(file_name));
67 return source; 67 return source;
68 } 68 }
69 69
(...skipping 30 matching lines...) Expand all
100 // it can be deleted. 100 // it can be deleted.
101 delete packet; 101 delete packet;
102 } 102 }
103 } 103 }
104 return nullptr; 104 return nullptr;
105 } 105 }
106 106
107 int64_t RtcEventLogSource::NextAudioOutputEventMs() { 107 int64_t RtcEventLogSource::NextAudioOutputEventMs() {
108 while (audio_output_index_ < event_log_->stream_size()) { 108 while (audio_output_index_ < event_log_->stream_size()) {
109 const rtclog::Event& event = event_log_->stream(audio_output_index_); 109 const rtclog::Event& event = event_log_->stream(audio_output_index_);
110 const rtclog::DebugEvent* debug_event = GetAudioOutputEvent(event); 110 const rtclog::AudioPlayoutEvent* playout_event =
111 GetAudioPlayoutEvent(event);
111 audio_output_index_++; 112 audio_output_index_++;
112 if (debug_event) 113 if (playout_event)
113 return event.timestamp_us() / 1000; 114 return event.timestamp_us() / 1000;
114 } 115 }
115 return std::numeric_limits<int64_t>::max(); 116 return std::numeric_limits<int64_t>::max();
116 } 117 }
117 118
118 RtcEventLogSource::RtcEventLogSource() 119 RtcEventLogSource::RtcEventLogSource()
119 : PacketSource(), parser_(RtpHeaderParser::Create()) {} 120 : PacketSource(), parser_(RtpHeaderParser::Create()) {}
120 121
121 bool RtcEventLogSource::OpenFile(const std::string& file_name) { 122 bool RtcEventLogSource::OpenFile(const std::string& file_name) {
122 event_log_.reset(new rtclog::EventStream()); 123 event_log_.reset(new rtclog::EventStream());
123 return RtcEventLog::ParseRtcEventLog(file_name, event_log_.get()); 124 return RtcEventLog::ParseRtcEventLog(file_name, event_log_.get());
124 } 125 }
125 126
126 } // namespace test 127 } // namespace test
127 } // namespace webrtc 128 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call/rtc_event_log_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698