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

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

Issue 23467003: Added framer to cast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rtcp
Patch Set: 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
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_FRAMER_H_
6 #define MEDIA_CAST_FRAMER_FRAMER_H_
7
8 #include <map>
9
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/time/default_tick_clock.h"
13 #include "base/time/tick_clock.h"
14 #include "base/time/time.h"
15 #include "media/cast/framer/cast_message_builder.h"
16 #include "media/cast/framer/frame_buffer.h"
17 #include "media/cast/framer/frame_id_map.h"
18 #include "media/cast/rtcp/rtcp.h"
19 #include "media/cast/rtp_common/rtp_defines.h"
20
21 namespace media {
22 namespace cast {
23
24 typedef std::map<uint8, FrameBuffer*> FrameList;
Alpha Left Google 2013/08/28 00:27:31 This should be linked_ptr<FrameBuffer> instead of
pwestin 2013/08/28 16:40:44 Done.
25
26 class Framer {
27 public:
28 Framer(RtpPayloadFeedback* incoming_payload_feedback,
29 uint32 ssrc,
30 bool decoder_faster_than_max_frame_rate,
31 int max_unacked_frames);
32 ~Framer();
33
34 void InsertPacket(const uint8* payload_data,
35 int payload_size,
36 const RtpCastHeader& rtp_header);
37
38 // Extracts a complete encoded frame - will only return a complete continuous
39 // frame.
40 // Returns false if the frame does not exist or if the frame is not complete
41 // within the given time frame.
42 bool GetEncodedVideoFrame(const base::TimeTicks& timeout,
43 EncodedVideoFrame* video_frame,
44 uint32* rtp_timestamp,
45 bool* next_frame);
46
47 bool GetEncodedAudioFrame(const base::TimeTicks& timeout,
48 EncodedAudioFrame* audio_frame,
49 uint32* rtp_timestamp,
50 bool* next_frame);
51
52 void ReleaseFrame(uint8 frame_id);
53
54 // Reset framer state to original state and flush all pending buffers.
55 void Reset();
56 bool TimeToSendNextCastMessage(base::TimeTicks* time_to_send);
57 void SendCastMessage();
58
59 void set_clock(base::TickClock* clock) {
60 clock_ = clock;
61 cast_msg_builder_->set_clock(clock);
62 }
63
64 private:
65 // Return true if we should wait.
66 bool WaitForNextFrame(const base::TimeTicks& timeout) const;
67
68 const bool decoder_faster_than_max_frame_rate_;
69 FrameList frames_;
70 FrameIdMap frame_id_map_;
71
72 CastMessageBuilder* cast_msg_builder_;
Alpha Left Google 2013/08/28 00:27:31 Use scoped_ptr<>.
pwestin 2013/08/28 16:40:44 Done.
73
74 scoped_ptr<base::TickClock> default_tick_clock_;
75 base::TickClock* clock_;
76
77 DISALLOW_COPY_AND_ASSIGN(Framer);
78 };
79
80 } // namespace cast
81 } // namespace media
82
83 #endif // MEDIA_CAST_FRAMER_FRAMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698