| 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 #include "media/cast/logging/log_deserializer.h" | 5 #include "media/cast/logging/log_deserializer.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> |
| 9 #include <utility> | 10 #include <utility> |
| 10 | 11 |
| 11 #include "base/big_endian.h" | 12 #include "base/big_endian.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "third_party/zlib/zlib.h" | 13 #include "third_party/zlib/zlib.h" |
| 14 | 14 |
| 15 using media::cast::FrameEventMap; | 15 using media::cast::FrameEventMap; |
| 16 using media::cast::PacketEventMap; | 16 using media::cast::PacketEventMap; |
| 17 using media::cast::RtpTimeDelta; | 17 using media::cast::RtpTimeDelta; |
| 18 using media::cast::RtpTimeTicks; | 18 using media::cast::RtpTimeTicks; |
| 19 using media::cast::proto::AggregatedFrameEvent; | 19 using media::cast::proto::AggregatedFrameEvent; |
| 20 using media::cast::proto::AggregatedPacketEvent; | 20 using media::cast::proto::AggregatedPacketEvent; |
| 21 using media::cast::proto::BasePacketEvent; | 21 using media::cast::proto::BasePacketEvent; |
| 22 using media::cast::proto::LogMetadata; | 22 using media::cast::proto::LogMetadata; |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 namespace cast { | 224 namespace cast { |
| 225 | 225 |
| 226 bool DeserializeEvents(const char* data, | 226 bool DeserializeEvents(const char* data, |
| 227 int data_bytes, | 227 int data_bytes, |
| 228 bool compressed, | 228 bool compressed, |
| 229 DeserializedLog* audio_log, | 229 DeserializedLog* audio_log, |
| 230 DeserializedLog* video_log) { | 230 DeserializedLog* video_log) { |
| 231 DCHECK_GT(data_bytes, 0); | 231 DCHECK_GT(data_bytes, 0); |
| 232 | 232 |
| 233 if (compressed) { | 233 if (compressed) { |
| 234 scoped_ptr<char[]> uncompressed(new char[kMaxUncompressedBytes]); | 234 std::unique_ptr<char[]> uncompressed(new char[kMaxUncompressedBytes]); |
| 235 int uncompressed_bytes = 0; | 235 int uncompressed_bytes = 0; |
| 236 if (!Uncompress(data, | 236 if (!Uncompress(data, |
| 237 data_bytes, | 237 data_bytes, |
| 238 kMaxUncompressedBytes, | 238 kMaxUncompressedBytes, |
| 239 uncompressed.get(), | 239 uncompressed.get(), |
| 240 &uncompressed_bytes)) | 240 &uncompressed_bytes)) |
| 241 return false; | 241 return false; |
| 242 | 242 |
| 243 return DoDeserializeEvents( | 243 return DoDeserializeEvents( |
| 244 uncompressed.get(), uncompressed_bytes, audio_log, video_log); | 244 uncompressed.get(), uncompressed_bytes, audio_log, video_log); |
| 245 } else { | 245 } else { |
| 246 return DoDeserializeEvents(data, data_bytes, audio_log, video_log); | 246 return DoDeserializeEvents(data, data_bytes, audio_log, video_log); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 DeserializedLog::DeserializedLog() {} | 250 DeserializedLog::DeserializedLog() {} |
| 251 DeserializedLog::~DeserializedLog() {} | 251 DeserializedLog::~DeserializedLog() {} |
| 252 | 252 |
| 253 } // namespace cast | 253 } // namespace cast |
| 254 } // namespace media | 254 } // namespace media |
| OLD | NEW |