Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: media/cast/logging/log_serializer.h

Issue 170063006: Cast: Add JS API to get raw events logs from cast extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pass presubmit Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef MEDIA_CAST_LOGGING_LOG_SERIALIZER_H_ 5 #ifndef MEDIA_CAST_LOGGING_LOG_SERIALIZER_H_
6 #define MEDIA_CAST_LOGGING_LOG_SERIALIZER_H_ 6 #define MEDIA_CAST_LOGGING_LOG_SERIALIZER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 18 matching lines...) Expand all
29 // 3. Call |GetSerializedLogAndReset()| to get the result. 29 // 3. Call |GetSerializedLogAndReset()| to get the result.
30 // 4. (Optional) Call |GetSerializedLengthSoFar()| between each serialize call. 30 // 4. (Optional) Call |GetSerializedLengthSoFar()| between each serialize call.
31 class LogSerializer { 31 class LogSerializer {
32 public: 32 public:
33 // Constructs a LogSerializer that caps size of serialized message to 33 // Constructs a LogSerializer that caps size of serialized message to
34 // |max_serialized_bytes|. 34 // |max_serialized_bytes|.
35 LogSerializer(const int max_serialized_bytes); 35 LogSerializer(const int max_serialized_bytes);
36 ~LogSerializer(); 36 ~LogSerializer();
37 37
38 // Serialize |frame_events|, |packet_events|, |first_rtp_timestamp| 38 // Serialize |frame_events|, |packet_events|, |first_rtp_timestamp|
39 // returned from EncodingEventSubscriber associated with |stream_id|. 39 // returned from EncodingEventSubscriber. |is_audio| indicates whether the
40 // events are from an audio or video stream.
40 // 41 //
41 // Returns |true| if serialization is successful. This function 42 // Returns |true| if serialization is successful. This function
42 // returns |false| if the serialized string will exceed |kMaxSerializedsize|. 43 // returns |false| if the serialized string will exceed |kMaxSerializedsize|.
43 // 44 //
44 // This may be called multiple times with different streams and events before 45 // This may be called multiple times with different streams and events before
45 // calling |GetSerializedString()|. 46 // calling |GetSerializedString()|.
46 // 47 //
47 // See .cc file for format specification. 48 // See .cc file for format specification.
48 bool SerializeEventsForStream(const int stream_id, 49 bool SerializeEventsForStream(bool is_audio,
49 const FrameEventMap& frame_events, 50 const FrameEventMap& frame_events,
50 const PacketEventMap& packet_events, 51 const PacketEventMap& packet_events,
51 const RtpTimestamp first_rtp_timestamp); 52 const RtpTimestamp first_rtp_timestamp);
52 53
53 // Gets a string of serialized events up to the last successful call to 54 // Gets a string of serialized events up to the last successful call to
54 // |SerializeEventsForStream()| and resets it. 55 // |SerializeEventsForStream()| and resets it.
55 scoped_ptr<std::string> GetSerializedLogAndReset(); 56 scoped_ptr<std::string> GetSerializedLogAndReset();
56 57
57 // Returns the length of the serialized string since last 58 // Returns the length of the serialized string since last
58 // successful serialization / reset. 59 // successful serialization / reset.
59 int GetSerializedLength() const; 60 int GetSerializedLength() const;
60 61
61 private: 62 private:
62 scoped_ptr<std::string> serialized_log_so_far_; 63 scoped_ptr<std::string> serialized_log_so_far_;
63 int index_so_far_; 64 int index_so_far_;
64 const int max_serialized_bytes_; 65 const int max_serialized_bytes_;
65 }; 66 };
66 67
67 } // namespace cast 68 } // namespace cast
68 } // namespace media 69 } // namespace media
69 70
70 #endif // MEDIA_CAST_LOGGING_LOG_SERIALIZER_H_ 71 #endif // MEDIA_CAST_LOGGING_LOG_SERIALIZER_H_
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/cast_streaming/common.js ('k') | media/cast/logging/log_serializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698