Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / media / cast / logging / log_deserializer.h
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_CAST_LOGGING_LOG_DESERIALIZER_H_
6 #define MEDIA_CAST_LOGGING_LOG_DESERIALIZER_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/memory/linked_ptr.h"
12 #include "media/cast/logging/logging_defines.h"
13 #include "media/cast/logging/proto/raw_events.pb.h"
14
15 namespace media {
16 namespace cast {
17
18 typedef std::map<RtpTimestamp,
19                  linked_ptr<media::cast::proto::AggregatedFrameEvent> >
20     FrameEventMap;
21 typedef std::map<RtpTimestamp,
22                  linked_ptr<media::cast::proto::AggregatedPacketEvent> >
23     PacketEventMap;
24
25 // Represents deserialized raw event logs for a particular stream.
26 struct DeserializedLog {
27   DeserializedLog();
28   ~DeserializedLog();
29   proto::LogMetadata metadata;
30   FrameEventMap frame_events;
31   PacketEventMap packet_events;
32 };
33
34 // This function takes the output of LogSerializer and deserializes it into
35 // its original format. Returns true if deserialization is successful. All
36 // output arguments are valid if this function returns true.
37 // |data|: Serialized event logs with length |data_bytes|.
38 // |compressed|: true if |data| is compressed in gzip format.
39 // |log_metadata|: This will be populated with deserialized LogMetadata proto.
40 // |audio_log|, |video_log|: These will be populated with deserialized
41 // log data for audio and video streams, respectively.
42 bool DeserializeEvents(const char* data,
43                        int data_bytes,
44                        bool compressed,
45                        DeserializedLog* audio_log,
46                        DeserializedLog* video_log);
47
48 }  // namespace cast
49 }  // namespace media
50
51 #endif  // MEDIA_CAST_LOGGING_LOG_DESERIALIZER_H_