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

Side by Side Diff: media/cast/receiver/cast_receiver_impl.cc

Issue 387933005: Cast: Refactor RTCP handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: smaller diff Created 6 years, 5 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 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 #include "media/cast/receiver/cast_receiver_impl.h" 5 #include "media/cast/receiver/cast_receiver_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "media/cast/net/rtcp/rtcp_receiver.h"
13 #include "media/cast/receiver/audio_decoder.h" 14 #include "media/cast/receiver/audio_decoder.h"
14 #include "media/cast/receiver/video_decoder.h" 15 #include "media/cast/receiver/video_decoder.h"
15 16
16 namespace media { 17 namespace media {
17 namespace cast { 18 namespace cast {
18 19
19 scoped_ptr<CastReceiver> CastReceiver::Create( 20 scoped_ptr<CastReceiver> CastReceiver::Create(
20 scoped_refptr<CastEnvironment> cast_environment, 21 scoped_refptr<CastEnvironment> cast_environment,
21 const FrameReceiverConfig& audio_config, 22 const FrameReceiverConfig& audio_config,
22 const FrameReceiverConfig& video_config, 23 const FrameReceiverConfig& video_config,
(...skipping 21 matching lines...) Expand all
44 audio_codec_(audio_config.codec), 45 audio_codec_(audio_config.codec),
45 video_codec_(video_config.codec) {} 46 video_codec_(video_config.codec) {}
46 47
47 CastReceiverImpl::~CastReceiverImpl() {} 48 CastReceiverImpl::~CastReceiverImpl() {}
48 49
49 void CastReceiverImpl::DispatchReceivedPacket(scoped_ptr<Packet> packet) { 50 void CastReceiverImpl::DispatchReceivedPacket(scoped_ptr<Packet> packet) {
50 const uint8_t* const data = &packet->front(); 51 const uint8_t* const data = &packet->front();
51 const size_t length = packet->size(); 52 const size_t length = packet->size();
52 53
53 uint32 ssrc_of_sender; 54 uint32 ssrc_of_sender;
54 if (Rtcp::IsRtcpPacket(data, length)) { 55 if (RtcpReceiver::IsRtcpPacket(data, length)) {
55 ssrc_of_sender = Rtcp::GetSsrcOfSender(data, length); 56 ssrc_of_sender = RtcpReceiver::GetSsrcOfSender(data, length);
56 } else if (!FrameReceiver::ParseSenderSsrc(data, length, &ssrc_of_sender)) { 57 } else if (!FrameReceiver::ParseSenderSsrc(data, length, &ssrc_of_sender)) {
57 VLOG(1) << "Invalid RTP packet."; 58 VLOG(1) << "Invalid RTP packet.";
58 return; 59 return;
59 } 60 }
60 61
61 base::WeakPtr<FrameReceiver> target; 62 base::WeakPtr<FrameReceiver> target;
62 if (ssrc_of_sender == ssrc_of_video_sender_) { 63 if (ssrc_of_sender == ssrc_of_video_sender_) {
63 target = video_receiver_.AsWeakPtr(); 64 target = video_receiver_.AsWeakPtr();
64 } else if (ssrc_of_sender == ssrc_of_audio_sender_) { 65 } else if (ssrc_of_sender == ssrc_of_audio_sender_) {
65 target = audio_receiver_.AsWeakPtr(); 66 target = audio_receiver_.AsWeakPtr();
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 TRACE_EVENT_INSTANT1( 224 TRACE_EVENT_INSTANT1(
224 "cast_perf_test", "FrameDecoded", 225 "cast_perf_test", "FrameDecoded",
225 TRACE_EVENT_SCOPE_THREAD, 226 TRACE_EVENT_SCOPE_THREAD,
226 "rtp_timestamp", rtp_timestamp); 227 "rtp_timestamp", rtp_timestamp);
227 } 228 }
228 callback.Run(video_frame, playout_time, is_continuous); 229 callback.Run(video_frame, playout_time, is_continuous);
229 } 230 }
230 231
231 } // namespace cast 232 } // namespace cast
232 } // namespace media 233 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698