OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 |
11 #include "webrtc/modules/audio_coding/audio_network_adaptor/debug_dump_writer.h" | 11 #include "webrtc/modules/audio_coding/audio_network_adaptor/debug_dump_writer.h" |
12 | 12 |
13 #include "webrtc/base/checks.h" | 13 #include "webrtc/base/checks.h" |
14 #include "webrtc/base/ignore_wundef.h" | 14 #include "webrtc/base/ignore_wundef.h" |
15 #include "webrtc/base/protobuf_utils.h" | |
16 | 15 |
17 #ifdef WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP | 16 #ifdef WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP |
18 RTC_PUSH_IGNORING_WUNDEF() | 17 RTC_PUSH_IGNORING_WUNDEF() |
19 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD | 18 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD |
20 #include "external/webrtc/webrtc/modules/audio_coding/audio_network_adaptor/debu
g_dump.pb.h" | 19 #include "external/webrtc/webrtc/modules/audio_coding/audio_network_adaptor/debu
g_dump.pb.h" |
21 #else | 20 #else |
22 #include "webrtc/modules/audio_coding/audio_network_adaptor/debug_dump.pb.h" | 21 #include "webrtc/modules/audio_coding/audio_network_adaptor/debug_dump.pb.h" |
23 #endif | 22 #endif |
24 RTC_POP_IGNORING_WUNDEF() | 23 RTC_POP_IGNORING_WUNDEF() |
25 #endif | 24 #endif |
26 | 25 |
27 namespace webrtc { | 26 namespace webrtc { |
28 | 27 |
29 #ifdef WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP | 28 #ifdef WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP |
30 namespace { | 29 namespace { |
31 | 30 |
32 using audio_network_adaptor::debug_dump::Event; | 31 using audio_network_adaptor::debug_dump::Event; |
33 using audio_network_adaptor::debug_dump::NetworkMetrics; | 32 using audio_network_adaptor::debug_dump::NetworkMetrics; |
34 using audio_network_adaptor::debug_dump::EncoderRuntimeConfig; | 33 using audio_network_adaptor::debug_dump::EncoderRuntimeConfig; |
35 | 34 |
36 void DumpEventToFile(const Event& event, FileWrapper* dump_file) { | 35 void DumpEventToFile(const Event& event, FileWrapper* dump_file) { |
37 RTC_CHECK(dump_file->is_open()); | 36 RTC_CHECK(dump_file->is_open()); |
38 ProtoString dump_data; | 37 std::string dump_data; |
39 event.SerializeToString(&dump_data); | 38 event.SerializeToString(&dump_data); |
40 int32_t size = event.ByteSize(); | 39 int32_t size = event.ByteSize(); |
41 dump_file->Write(&size, sizeof(size)); | 40 dump_file->Write(&size, sizeof(size)); |
42 dump_file->Write(dump_data.data(), dump_data.length()); | 41 dump_file->Write(dump_data.data(), dump_data.length()); |
43 } | 42 } |
44 | 43 |
45 } // namespace | 44 } // namespace |
46 #endif // WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP | 45 #endif // WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP |
47 | 46 |
48 class DebugDumpWriterImpl final : public DebugDumpWriter { | 47 class DebugDumpWriterImpl final : public DebugDumpWriter { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 134 |
136 DumpEventToFile(event, dump_file_.get()); | 135 DumpEventToFile(event, dump_file_.get()); |
137 #endif // WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP | 136 #endif // WEBRTC_AUDIO_NETWORK_ADAPTOR_DEBUG_DUMP |
138 } | 137 } |
139 | 138 |
140 std::unique_ptr<DebugDumpWriter> DebugDumpWriter::Create(FILE* file_handle) { | 139 std::unique_ptr<DebugDumpWriter> DebugDumpWriter::Create(FILE* file_handle) { |
141 return std::unique_ptr<DebugDumpWriter>(new DebugDumpWriterImpl(file_handle)); | 140 return std::unique_ptr<DebugDumpWriter>(new DebugDumpWriterImpl(file_handle)); |
142 } | 141 } |
143 | 142 |
144 } // namespace webrtc | 143 } // namespace webrtc |
OLD | NEW |