summaryrefslogtreecommitdiffstats
path: root/media/cast/logging/log_deserializer.h
blob: c9d4c7249729394caa7be5e41e0d751c5d0924e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MEDIA_CAST_LOGGING_LOG_DESERIALIZER_H_
#define MEDIA_CAST_LOGGING_LOG_DESERIALIZER_H_

#include <map>
#include <string>

#include "base/memory/linked_ptr.h"
#include "media/cast/logging/logging_defines.h"
#include "media/cast/logging/proto/raw_events.pb.h"

namespace media {
namespace cast {

typedef std::map<RtpTimeTicks,
                 linked_ptr<media::cast::proto::AggregatedFrameEvent>>
    FrameEventMap;
typedef std::map<RtpTimeTicks,
                 linked_ptr<media::cast::proto::AggregatedPacketEvent>>
    PacketEventMap;

// Represents deserialized raw event logs for a particular stream.
struct DeserializedLog {
  DeserializedLog();
  ~DeserializedLog();
  proto::LogMetadata metadata;
  FrameEventMap frame_events;
  PacketEventMap packet_events;
};

// This function takes the output of LogSerializer and deserializes it into
// its original format. Returns true if deserialization is successful. All
// output arguments are valid if this function returns true.
// |data|: Serialized event logs with length |data_bytes|.
// |compressed|: true if |data| is compressed in gzip format.
// |log_metadata|: This will be populated with deserialized LogMetadata proto.
// |audio_log|, |video_log|: These will be populated with deserialized
// log data for audio and video streams, respectively.
bool DeserializeEvents(const char* data,
                       int data_bytes,
                       bool compressed,
                       DeserializedLog* audio_log,
                       DeserializedLog* video_log);

}  // namespace cast
}  // namespace media

#endif  // MEDIA_CAST_LOGGING_LOG_DESERIALIZER_H_