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

Side by Side Diff: media/cast/framer/frame_id_map.h

Issue 23467003: Added framer to cast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rtcp
Patch Set: Merge Created 7 years, 3 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
« no previous file with comments | « media/cast/framer/frame_buffer_unittest.cc ('k') | media/cast/framer/frame_id_map.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 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_FRAMER_FRAME_ID_MAP_H_
6 #define MEDIA_CAST_FRAMER_FRAME_ID_MAP_H_
7
8 #include <map>
9 #include <set>
10
11 #include "base/memory/linked_ptr.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "media/cast/cast_config.h"
14 #include "media/cast/rtcp/rtcp_defines.h"
15 #include "media/cast/rtp_common/rtp_defines.h"
16
17 namespace media {
18 namespace cast {
19
20 class FrameInfo {
21 public:
22 FrameInfo(uint8 frame_id,
23 uint8 referenced_frame_id,
24 uint16 max_packet_id,
25 bool key_frame);
26 ~FrameInfo();
27
28 // Returns true if frame is complete after the insert.
29 bool InsertPacket(uint16 packet_id);
30 bool Complete() const;
31 void GetMissingPackets(bool newest_frame,
32 PacketIdSet* missing_packets) const;
33
34 bool is_key_frame() const { return is_key_frame_; }
35 uint8 frame_id() const { return frame_id_; }
36 uint8 referenced_frame_id() const { return referenced_frame_id_; }
37
38 private:
39 const bool is_key_frame_;
40 const uint8 frame_id_;
41 const uint8 referenced_frame_id_;
42
43 uint16 max_received_packet_id_;
44 PacketIdSet missing_packets_;
45
46 DISALLOW_COPY_AND_ASSIGN(FrameInfo);
47 };
48
49 typedef std::map<uint8, linked_ptr<FrameInfo> > FrameMap;
50
51 class FrameIdMap {
52 public:
53 FrameIdMap();
54 ~FrameIdMap();
55
56 // Returns false if not a valid (old) packet, otherwise returns true.
57 bool InsertPacket(const RtpCastHeader& rtp_header, bool* complete);
58
59 bool Empty() const;
60 bool FrameExists(uint8 frame_id) const;
61 uint8 NewestFrameId() const;
62
63 void RemoveOldFrames(uint8 frame_id);
64 void Clear();
65
66 // Identifies the next frame to be released (rendered).
67 bool NextContinuousFrame(uint8* frame_id) const;
68 uint8 LastContinuousFrame() const;
69
70 bool NextAudioFrameAllowingMissingFrames(uint8* frame_id) const;
71 bool NextVideoFrameAllowingSkippingFrames(uint8* frame_id) const;
72
73 int NumberOfCompleteFrames() const;
74 void GetMissingPackets(uint8 frame_id,
75 bool last_frame,
76 PacketIdSet* missing_packets) const;
77
78 private:
79 bool ContinuousFrame(FrameInfo* frame) const;
80 bool DecodableVideoFrame(FrameInfo* frame) const;
81
82 FrameMap frame_map_;
83 bool waiting_for_key_;
84 uint8 last_released_frame_;
85 uint8 newest_frame_id_;
86
87 DISALLOW_COPY_AND_ASSIGN(FrameIdMap);
88 };
89
90 } // namespace cast
91 } // namespace media
92
93 #endif // MEDIA_CAST_FRAMER_FRAME_ID_MAP_H_
OLDNEW
« no previous file with comments | « media/cast/framer/frame_buffer_unittest.cc ('k') | media/cast/framer/frame_id_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698