| OLD | NEW |
| 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_FRAMER_FRAMER_H_ | 5 #ifndef MEDIA_CAST_FRAMER_FRAMER_H_ |
| 6 #define MEDIA_CAST_FRAMER_FRAMER_H_ | 6 #define MEDIA_CAST_FRAMER_FRAMER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/time/tick_clock.h" | 13 #include "base/time/tick_clock.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "media/cast/net/rtcp/rtcp.h" | 15 #include "media/cast/net/rtcp/rtcp.h" |
| 16 #include "media/cast/net/rtp/cast_message_builder.h" | 16 #include "media/cast/net/rtp/cast_message_builder.h" |
| 17 #include "media/cast/net/rtp/frame_buffer.h" | 17 #include "media/cast/net/rtp/frame_buffer.h" |
| 18 #include "media/cast/net/rtp/frame_id_map.h" | |
| 19 #include "media/cast/net/rtp/rtp_receiver_defines.h" | 18 #include "media/cast/net/rtp/rtp_receiver_defines.h" |
| 20 | 19 |
| 21 namespace media { | 20 namespace media { |
| 22 namespace cast { | 21 namespace cast { |
| 23 | 22 |
| 24 typedef std::map<uint32, linked_ptr<FrameBuffer> > FrameList; | 23 typedef std::map<uint32, linked_ptr<FrameBuffer> > FrameList; |
| 25 | 24 |
| 26 class Framer { | 25 class Framer { |
| 27 public: | 26 public: |
| 28 Framer(base::TickClock* clock, | 27 Framer(base::TickClock* clock, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 52 // TODO(hubbe): Move this elsewhere. | 51 // TODO(hubbe): Move this elsewhere. |
| 53 void AckFrame(uint32 frame_id); | 52 void AckFrame(uint32 frame_id); |
| 54 | 53 |
| 55 void ReleaseFrame(uint32 frame_id); | 54 void ReleaseFrame(uint32 frame_id); |
| 56 | 55 |
| 57 // Reset framer state to original state and flush all pending buffers. | 56 // Reset framer state to original state and flush all pending buffers. |
| 58 void Reset(); | 57 void Reset(); |
| 59 bool TimeToSendNextCastMessage(base::TimeTicks* time_to_send); | 58 bool TimeToSendNextCastMessage(base::TimeTicks* time_to_send); |
| 60 void SendCastMessage(); | 59 void SendCastMessage(); |
| 61 | 60 |
| 61 bool Empty() const; |
| 62 bool FrameExists(uint32 frame_id) const; |
| 63 uint32 NewestFrameId() const; |
| 64 |
| 65 void RemoveOldFrames(uint32 frame_id); |
| 66 |
| 67 // Identifies the next frame to be released (rendered). |
| 68 bool NextContinuousFrame(uint32* frame_id) const; |
| 69 uint32 LastContinuousFrame() const; |
| 70 |
| 71 bool NextFrameAllowingSkippingFrames(uint32* frame_id) const; |
| 72 bool HaveMultipleDecodableFrames() const; |
| 73 |
| 74 int NumberOfCompleteFrames() const; |
| 75 void GetMissingPackets(uint32 frame_id, |
| 76 bool last_frame, |
| 77 PacketIdSet* missing_packets) const; |
| 78 |
| 62 private: | 79 private: |
| 80 bool ContinuousFrame(FrameBuffer* frame) const; |
| 81 bool DecodableFrame(FrameBuffer* frame) const; |
| 82 |
| 63 const bool decoder_faster_than_max_frame_rate_; | 83 const bool decoder_faster_than_max_frame_rate_; |
| 64 FrameList frames_; | 84 FrameList frames_; |
| 65 FrameIdMap frame_id_map_; | |
| 66 | |
| 67 scoped_ptr<CastMessageBuilder> cast_msg_builder_; | 85 scoped_ptr<CastMessageBuilder> cast_msg_builder_; |
| 86 bool waiting_for_key_; |
| 87 uint32 last_released_frame_; |
| 88 uint32 newest_frame_id_; |
| 68 | 89 |
| 69 DISALLOW_COPY_AND_ASSIGN(Framer); | 90 DISALLOW_COPY_AND_ASSIGN(Framer); |
| 70 }; | 91 }; |
| 71 | 92 |
| 72 } // namespace cast | 93 } // namespace cast |
| 73 } // namespace media | 94 } // namespace media |
| 74 | 95 |
| 75 #endif // MEDIA_CAST_FRAMER_FRAMER_H_ | 96 #endif // MEDIA_CAST_FRAMER_FRAMER_H_ |
| OLD | NEW |