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

Side by Side Diff: media/cast/framer/frame_buffer.cc

Issue 109413004: Cast:Adding cast_transport_config and cleaning up (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Injecting TaskRunner Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 #include "media/cast/framer/frame_buffer.h" 5 #include "media/cast/framer/frame_buffer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace media { 9 namespace media {
10 namespace cast { 10 namespace cast {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 retval.first->second.begin()); 56 retval.first->second.begin());
57 57
58 ++num_packets_received_; 58 ++num_packets_received_;
59 total_data_size_ += payload_size; 59 total_data_size_ += payload_size;
60 } 60 }
61 61
62 bool FrameBuffer::Complete() const { 62 bool FrameBuffer::Complete() const {
63 return num_packets_received_ - 1 == max_packet_id_; 63 return num_packets_received_ - 1 == max_packet_id_;
64 } 64 }
65 65
66 bool FrameBuffer::GetEncodedAudioFrame(EncodedAudioFrame* audio_frame, 66 bool FrameBuffer::GetEncodedAudioFrame(
67 uint32* rtp_timestamp) const { 67 transport::EncodedAudioFrame* audio_frame,
68 uint32* rtp_timestamp) const {
68 if (!Complete()) return false; 69 if (!Complete()) return false;
69 70
70 *rtp_timestamp = rtp_timestamp_; 71 *rtp_timestamp = rtp_timestamp_;
71 72
72 // Frame is complete -> construct. 73 // Frame is complete -> construct.
73 audio_frame->frame_id = frame_id_; 74 audio_frame->frame_id = frame_id_;
74 75
75 // Build the data vector. 76 // Build the data vector.
76 audio_frame->data.clear(); 77 audio_frame->data.clear();
77 audio_frame->data.reserve(total_data_size_); 78 audio_frame->data.reserve(total_data_size_);
78 PacketMap::const_iterator it; 79 PacketMap::const_iterator it;
79 for (it = packets_.begin(); it != packets_.end(); ++it) { 80 for (it = packets_.begin(); it != packets_.end(); ++it) {
80 audio_frame->data.insert(audio_frame->data.end(), 81 audio_frame->data.insert(audio_frame->data.end(),
81 it->second.begin(), it->second.end()); 82 it->second.begin(), it->second.end());
82 } 83 }
83 return true; 84 return true;
84 } 85 }
85 86
86 bool FrameBuffer::GetEncodedVideoFrame(EncodedVideoFrame* video_frame, 87 bool FrameBuffer::GetEncodedVideoFrame(
87 uint32* rtp_timestamp) const { 88 transport::EncodedVideoFrame* video_frame,
89 uint32* rtp_timestamp) const {
88 if (!Complete()) return false; 90 if (!Complete()) return false;
89 91
90 *rtp_timestamp = rtp_timestamp_; 92 *rtp_timestamp = rtp_timestamp_;
91 93
92 // Frame is complete -> construct. 94 // Frame is complete -> construct.
93 video_frame->key_frame = is_key_frame_; 95 video_frame->key_frame = is_key_frame_;
94 video_frame->frame_id = frame_id_; 96 video_frame->frame_id = frame_id_;
95 video_frame->last_referenced_frame_id = last_referenced_frame_id_; 97 video_frame->last_referenced_frame_id = last_referenced_frame_id_;
96 98
97 // Build the data vector. 99 // Build the data vector.
98 video_frame->data.clear(); 100 video_frame->data.clear();
99 video_frame->data.reserve(total_data_size_); 101 video_frame->data.reserve(total_data_size_);
100 PacketMap::const_iterator it; 102 PacketMap::const_iterator it;
101 for (it = packets_.begin(); it != packets_.end(); ++it) { 103 for (it = packets_.begin(); it != packets_.end(); ++it) {
102 video_frame->data.insert(video_frame->data.end(), 104 video_frame->data.insert(video_frame->data.end(),
103 it->second.begin(), it->second.end()); 105 it->second.begin(), it->second.end());
104 } 106 }
105 return true; 107 return true;
106 } 108 }
107 109
108 } // namespace cast 110 } // namespace cast
109 } // namespace media 111 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698