OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Test application that simulates a cast sender - Data can be either generated | 5 // Test application that simulates a cast sender - Data can be either generated |
6 // or read from a file. | 6 // or read from a file. |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | |
10 #include <queue> | 9 #include <queue> |
| 10 #include <utility> |
11 | 11 |
12 #include "base/at_exit.h" | 12 #include "base/at_exit.h" |
13 #include "base/base_paths.h" | 13 #include "base/base_paths.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/json/json_writer.h" | 16 #include "base/json/json_writer.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 cast_environment->logger()->Unsubscribe(video_event_subscriber.get()); | 120 cast_environment->logger()->Unsubscribe(video_event_subscriber.get()); |
121 cast_environment->logger()->Unsubscribe(audio_event_subscriber.get()); | 121 cast_environment->logger()->Unsubscribe(audio_event_subscriber.get()); |
122 | 122 |
123 VLOG(0) << "Dumping logging data for video stream."; | 123 VLOG(0) << "Dumping logging data for video stream."; |
124 media::cast::proto::LogMetadata log_metadata; | 124 media::cast::proto::LogMetadata log_metadata; |
125 media::cast::FrameEventList frame_events; | 125 media::cast::FrameEventList frame_events; |
126 media::cast::PacketEventList packet_events; | 126 media::cast::PacketEventList packet_events; |
127 video_event_subscriber->GetEventsAndReset( | 127 video_event_subscriber->GetEventsAndReset( |
128 &log_metadata, &frame_events, &packet_events); | 128 &log_metadata, &frame_events, &packet_events); |
129 | 129 |
130 DumpLoggingData(log_metadata, | 130 DumpLoggingData(log_metadata, frame_events, packet_events, |
131 frame_events, | 131 std::move(video_log_file)); |
132 packet_events, | |
133 video_log_file.Pass()); | |
134 | 132 |
135 VLOG(0) << "Dumping logging data for audio stream."; | 133 VLOG(0) << "Dumping logging data for audio stream."; |
136 audio_event_subscriber->GetEventsAndReset( | 134 audio_event_subscriber->GetEventsAndReset( |
137 &log_metadata, &frame_events, &packet_events); | 135 &log_metadata, &frame_events, &packet_events); |
138 | 136 |
139 DumpLoggingData(log_metadata, | 137 DumpLoggingData(log_metadata, frame_events, packet_events, |
140 frame_events, | 138 std::move(audio_log_file)); |
141 packet_events, | |
142 audio_log_file.Pass()); | |
143 } | 139 } |
144 | 140 |
145 void WriteStatsAndDestroySubscribers( | 141 void WriteStatsAndDestroySubscribers( |
146 const scoped_refptr<media::cast::CastEnvironment>& cast_environment, | 142 const scoped_refptr<media::cast::CastEnvironment>& cast_environment, |
147 scoped_ptr<media::cast::StatsEventSubscriber> video_stats_subscriber, | 143 scoped_ptr<media::cast::StatsEventSubscriber> video_stats_subscriber, |
148 scoped_ptr<media::cast::StatsEventSubscriber> audio_stats_subscriber, | 144 scoped_ptr<media::cast::StatsEventSubscriber> audio_stats_subscriber, |
149 scoped_ptr<media::cast::ReceiverTimeOffsetEstimatorImpl> estimator) { | 145 scoped_ptr<media::cast::ReceiverTimeOffsetEstimatorImpl> estimator) { |
150 cast_environment->logger()->Unsubscribe(video_stats_subscriber.get()); | 146 cast_environment->logger()->Unsubscribe(video_stats_subscriber.get()); |
151 cast_environment->logger()->Unsubscribe(audio_stats_subscriber.get()); | 147 cast_environment->logger()->Unsubscribe(audio_stats_subscriber.get()); |
152 cast_environment->logger()->Unsubscribe(estimator.get()); | 148 cast_environment->logger()->Unsubscribe(estimator.get()); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 base::Unretained(cast_sender.get()), | 323 base::Unretained(cast_sender.get()), |
328 audio_config, | 324 audio_config, |
329 base::Bind(&QuitLoopOnInitializationResult))); | 325 base::Bind(&QuitLoopOnInitializationResult))); |
330 io_message_loop.Run(); // Wait for audio initialization. | 326 io_message_loop.Run(); // Wait for audio initialization. |
331 | 327 |
332 fake_media_source->Start(cast_sender->audio_frame_input(), | 328 fake_media_source->Start(cast_sender->audio_frame_input(), |
333 cast_sender->video_frame_input()); | 329 cast_sender->video_frame_input()); |
334 io_message_loop.Run(); | 330 io_message_loop.Run(); |
335 return 0; | 331 return 0; |
336 } | 332 } |
OLD | NEW |