| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // Simulate end to end streaming. | 5 // Simulate end to end streaming. |
| 6 // | 6 // |
| 7 // Input: | 7 // Input: |
| 8 // --source= | 8 // --source= |
| 9 // WebM used as the source of video and audio frames. | 9 // WebM used as the source of video and audio frames. |
| 10 // --output= | 10 // --output= |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 true, | 179 true, |
| 180 media::cast::kMaxSerializedBytes, | 180 media::cast::kMaxSerializedBytes, |
| 181 serialized_log.get(), | 181 serialized_log.get(), |
| 182 &output_bytes); | 182 &output_bytes); |
| 183 | 183 |
| 184 if (!success) { | 184 if (!success) { |
| 185 LOG(ERROR) << "Failed to serialize log."; | 185 LOG(ERROR) << "Failed to serialize log."; |
| 186 return; | 186 return; |
| 187 } | 187 } |
| 188 | 188 |
| 189 if (AppendToFile(output_path, serialized_log.get(), output_bytes) == -1) { | 189 if (!AppendToFile(output_path, serialized_log.get(), output_bytes)) { |
| 190 LOG(ERROR) << "Failed to append to log."; | 190 LOG(ERROR) << "Failed to append to log."; |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 | 193 |
| 194 // Run simulation once. | 194 // Run simulation once. |
| 195 // | 195 // |
| 196 // |output_path| is the path to write serialized log. | 196 // |output_path| is the path to write serialized log. |
| 197 // |extra_data| is extra tagging information to write to log. | 197 // |extra_data| is extra tagging information to write to log. |
| 198 void RunSimulation(const base::FilePath& source_path, | 198 void RunSimulation(const base::FilePath& source_path, |
| 199 const base::FilePath& output_path, | 199 const base::FilePath& output_path, |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 values.SetBoolean("sim", true); | 537 values.SetBoolean("sim", true); |
| 538 values.SetString("sim-id", sim_id); | 538 values.SetString("sim-id", sim_id); |
| 539 | 539 |
| 540 std::string extra_data; | 540 std::string extra_data; |
| 541 base::JSONWriter::Write(&values, &extra_data); | 541 base::JSONWriter::Write(&values, &extra_data); |
| 542 | 542 |
| 543 // Run. | 543 // Run. |
| 544 media::cast::RunSimulation(source_path, output_path, extra_data, model); | 544 media::cast::RunSimulation(source_path, output_path, extra_data, model); |
| 545 return 0; | 545 return 0; |
| 546 } | 546 } |
| OLD | NEW |