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

Side by Side Diff: media/cast/net/rtp/framer.h

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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_NET_RTP_FRAMER_H_ 5 #ifndef MEDIA_CAST_NET_RTP_FRAMER_H_
6 #define MEDIA_CAST_NET_RTP_FRAMER_H_ 6 #define MEDIA_CAST_NET_RTP_FRAMER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h"
11 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
12 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
13 #include "base/time/tick_clock.h" 12 #include "base/time/tick_clock.h"
14 #include "base/time/time.h" 13 #include "base/time/time.h"
15 #include "media/cast/net/rtcp/rtcp.h" 14 #include "media/cast/net/rtcp/rtcp.h"
16 #include "media/cast/net/rtp/cast_message_builder.h" 15 #include "media/cast/net/rtp/cast_message_builder.h"
17 #include "media/cast/net/rtp/frame_buffer.h" 16 #include "media/cast/net/rtp/frame_buffer.h"
18 #include "media/cast/net/rtp/rtp_defines.h" 17 #include "media/cast/net/rtp/rtp_defines.h"
19 18
20 namespace media { 19 namespace media {
21 namespace cast { 20 namespace cast {
22 21
23 typedef std::map<uint32, linked_ptr<FrameBuffer> > FrameList; 22 typedef std::map<uint32_t, linked_ptr<FrameBuffer>> FrameList;
24 23
25 class Framer { 24 class Framer {
26 public: 25 public:
27 Framer(base::TickClock* clock, 26 Framer(base::TickClock* clock,
28 RtpPayloadFeedback* incoming_payload_feedback, 27 RtpPayloadFeedback* incoming_payload_feedback,
29 uint32 ssrc, 28 uint32_t ssrc,
30 bool decoder_faster_than_max_frame_rate, 29 bool decoder_faster_than_max_frame_rate,
31 int max_unacked_frames); 30 int max_unacked_frames);
32 ~Framer(); 31 ~Framer();
33 32
34 // Return true when receiving the last packet in a frame, creating a 33 // Return true when receiving the last packet in a frame, creating a
35 // complete frame. If a duplicate packet for an already complete frame is 34 // complete frame. If a duplicate packet for an already complete frame is
36 // received, the function returns false but sets |duplicate| to true. 35 // received, the function returns false but sets |duplicate| to true.
37 bool InsertPacket(const uint8* payload_data, 36 bool InsertPacket(const uint8_t* payload_data,
38 size_t payload_size, 37 size_t payload_size,
39 const RtpCastHeader& rtp_header, 38 const RtpCastHeader& rtp_header,
40 bool* duplicate); 39 bool* duplicate);
41 40
42 // Extracts a complete encoded frame - will only return a complete and 41 // Extracts a complete encoded frame - will only return a complete and
43 // decodable frame. Returns false if no such frames exist. 42 // decodable frame. Returns false if no such frames exist.
44 // |next_frame| will be set to true if the returned frame is the very 43 // |next_frame| will be set to true if the returned frame is the very
45 // next frame. |have_multiple_complete_frames| will be set to true 44 // next frame. |have_multiple_complete_frames| will be set to true
46 // if there are more decodadble frames available. 45 // if there are more decodadble frames available.
47 bool GetEncodedFrame(EncodedFrame* video_frame, 46 bool GetEncodedFrame(EncodedFrame* video_frame,
48 bool* next_frame, 47 bool* next_frame,
49 bool* have_multiple_complete_frames); 48 bool* have_multiple_complete_frames);
50 49
51 // TODO(hubbe): Move this elsewhere. 50 // TODO(hubbe): Move this elsewhere.
52 void AckFrame(uint32 frame_id); 51 void AckFrame(uint32_t frame_id);
53 52
54 void ReleaseFrame(uint32 frame_id); 53 void ReleaseFrame(uint32_t frame_id);
55 54
56 // Reset framer state to original state and flush all pending buffers. 55 // Reset framer state to original state and flush all pending buffers.
57 void Reset(); 56 void Reset();
58 bool TimeToSendNextCastMessage(base::TimeTicks* time_to_send); 57 bool TimeToSendNextCastMessage(base::TimeTicks* time_to_send);
59 void SendCastMessage(); 58 void SendCastMessage();
60 59
61 bool Empty() const; 60 bool Empty() const;
62 bool FrameExists(uint32 frame_id) const; 61 bool FrameExists(uint32_t frame_id) const;
63 uint32 NewestFrameId() const; 62 uint32_t NewestFrameId() const;
64 63
65 void RemoveOldFrames(uint32 frame_id); 64 void RemoveOldFrames(uint32_t frame_id);
66 65
67 // Identifies the next frame to be released (rendered). 66 // Identifies the next frame to be released (rendered).
68 bool NextContinuousFrame(uint32* frame_id) const; 67 bool NextContinuousFrame(uint32_t* frame_id) const;
69 uint32 LastContinuousFrame() const; 68 uint32_t LastContinuousFrame() const;
70 69
71 bool NextFrameAllowingSkippingFrames(uint32* frame_id) const; 70 bool NextFrameAllowingSkippingFrames(uint32_t* frame_id) const;
72 bool HaveMultipleDecodableFrames() const; 71 bool HaveMultipleDecodableFrames() const;
73 72
74 int NumberOfCompleteFrames() const; 73 int NumberOfCompleteFrames() const;
75 void GetMissingPackets(uint32 frame_id, 74 void GetMissingPackets(uint32_t frame_id,
76 bool last_frame, 75 bool last_frame,
77 PacketIdSet* missing_packets) const; 76 PacketIdSet* missing_packets) const;
78 77
79 private: 78 private:
80 bool ContinuousFrame(FrameBuffer* frame) const; 79 bool ContinuousFrame(FrameBuffer* frame) const;
81 bool DecodableFrame(FrameBuffer* frame) const; 80 bool DecodableFrame(FrameBuffer* frame) const;
82 81
83 const bool decoder_faster_than_max_frame_rate_; 82 const bool decoder_faster_than_max_frame_rate_;
84 FrameList frames_; 83 FrameList frames_;
85 scoped_ptr<CastMessageBuilder> cast_msg_builder_; 84 scoped_ptr<CastMessageBuilder> cast_msg_builder_;
86 bool waiting_for_key_; 85 bool waiting_for_key_;
87 uint32 last_released_frame_; 86 uint32_t last_released_frame_;
88 uint32 newest_frame_id_; 87 uint32_t newest_frame_id_;
89 88
90 DISALLOW_COPY_AND_ASSIGN(Framer); 89 DISALLOW_COPY_AND_ASSIGN(Framer);
91 }; 90 };
92 91
93 } // namespace cast 92 } // namespace cast
94 } // namespace media 93 } // namespace media
95 94
96 #endif // MEDIA_CAST_NET_RTP_FRAMER_H_ 95 #endif // MEDIA_CAST_NET_RTP_FRAMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698