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

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: nits 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
« no previous file with comments | « media/cast/framer/frame_buffer.h ('k') | media/cast/framer/frame_buffer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 retval.first->second.begin()); 54 retval.first->second.begin());
55 55
56 ++num_packets_received_; 56 ++num_packets_received_;
57 total_data_size_ += payload_size; 57 total_data_size_ += payload_size;
58 } 58 }
59 59
60 bool FrameBuffer::Complete() const { 60 bool FrameBuffer::Complete() const {
61 return num_packets_received_ - 1 == max_packet_id_; 61 return num_packets_received_ - 1 == max_packet_id_;
62 } 62 }
63 63
64 bool FrameBuffer::GetEncodedAudioFrame(EncodedAudioFrame* audio_frame, 64 bool FrameBuffer::GetEncodedAudioFrame(
65 uint32* rtp_timestamp) const { 65 transport::EncodedAudioFrame* audio_frame,
66 uint32* rtp_timestamp) const {
66 if (!Complete()) return false; 67 if (!Complete()) return false;
67 68
68 *rtp_timestamp = rtp_timestamp_; 69 *rtp_timestamp = rtp_timestamp_;
69 70
70 // Frame is complete -> construct. 71 // Frame is complete -> construct.
71 audio_frame->frame_id = frame_id_; 72 audio_frame->frame_id = frame_id_;
72 73
73 // Build the data vector. 74 // Build the data vector.
74 audio_frame->data.clear(); 75 audio_frame->data.clear();
75 audio_frame->data.reserve(total_data_size_); 76 audio_frame->data.reserve(total_data_size_);
76 PacketMap::const_iterator it; 77 PacketMap::const_iterator it;
77 for (it = packets_.begin(); it != packets_.end(); ++it) { 78 for (it = packets_.begin(); it != packets_.end(); ++it) {
78 audio_frame->data.insert(audio_frame->data.end(), 79 audio_frame->data.insert(audio_frame->data.end(),
79 it->second.begin(), it->second.end()); 80 it->second.begin(), it->second.end());
80 } 81 }
81 return true; 82 return true;
82 } 83 }
83 84
84 bool FrameBuffer::GetEncodedVideoFrame(EncodedVideoFrame* video_frame, 85 bool FrameBuffer::GetEncodedVideoFrame(
85 uint32* rtp_timestamp) const { 86 transport::EncodedVideoFrame* video_frame,
87 uint32* rtp_timestamp) const {
86 if (!Complete()) return false; 88 if (!Complete()) return false;
87 89
88 *rtp_timestamp = rtp_timestamp_; 90 *rtp_timestamp = rtp_timestamp_;
89 91
90 // Frame is complete -> construct. 92 // Frame is complete -> construct.
91 video_frame->key_frame = is_key_frame_; 93 video_frame->key_frame = is_key_frame_;
92 video_frame->frame_id = frame_id_; 94 video_frame->frame_id = frame_id_;
93 video_frame->last_referenced_frame_id = last_referenced_frame_id_; 95 video_frame->last_referenced_frame_id = last_referenced_frame_id_;
94 96
95 // Build the data vector. 97 // Build the data vector.
96 video_frame->data.clear(); 98 video_frame->data.clear();
97 video_frame->data.reserve(total_data_size_); 99 video_frame->data.reserve(total_data_size_);
98 PacketMap::const_iterator it; 100 PacketMap::const_iterator it;
99 for (it = packets_.begin(); it != packets_.end(); ++it) { 101 for (it = packets_.begin(); it != packets_.end(); ++it) {
100 video_frame->data.insert(video_frame->data.end(), 102 video_frame->data.insert(video_frame->data.end(),
101 it->second.begin(), it->second.end()); 103 it->second.begin(), it->second.end());
102 } 104 }
103 return true; 105 return true;
104 } 106 }
105 107
106 } // namespace cast 108 } // namespace cast
107 } // namespace media 109 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/framer/frame_buffer.h ('k') | media/cast/framer/frame_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698