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

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

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
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 #ifndef MEDIA_CAST_AUDIO_SENDER_H_ 5 #ifndef MEDIA_CAST_AUDIO_SENDER_H_
6 #define MEDIA_CAST_AUDIO_SENDER_H_ 6 #define MEDIA_CAST_AUDIO_SENDER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/threading/non_thread_safe.h" 12 #include "base/threading/non_thread_safe.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/cast_config.h" 15 #include "media/cast/cast_config.h"
16 #include "media/cast/cast_environment.h"
17 #include "media/cast/rtcp/rtcp.h" 16 #include "media/cast/rtcp/rtcp.h"
18 #include "media/cast/transport/rtp_sender/rtp_sender.h" 17 #include "media/cast/transport/rtp_sender/rtp_sender.h"
19 18
20 namespace crypto { 19 namespace crypto {
21 class Encryptor; 20 class Encryptor;
22 class SymmetricKey; 21 class SymmetricKey;
23 } 22 }
24 23
25 namespace media { 24 namespace media {
26 class AudioBus; 25 class AudioBus;
(...skipping 22 matching lines...) Expand all
49 // done with |audio_bus|; it does not mean that the encoded data has been 48 // done with |audio_bus|; it does not mean that the encoded data has been
50 // sent out. 49 // sent out.
51 void InsertAudio(const AudioBus* audio_bus, 50 void InsertAudio(const AudioBus* audio_bus,
52 const base::TimeTicks& recorded_time, 51 const base::TimeTicks& recorded_time,
53 const base::Closure& done_callback); 52 const base::Closure& done_callback);
54 53
55 // The audio_frame must be valid until the closure callback is called. 54 // The audio_frame must be valid until the closure callback is called.
56 // The closure callback is called from the main cast thread as soon as 55 // The closure callback is called from the main cast thread as soon as
57 // the cast sender is done with the frame; it does not mean that the encoded 56 // the cast sender is done with the frame; it does not mean that the encoded
58 // frame has been sent out. 57 // frame has been sent out.
59 void InsertCodedAudioFrame(const EncodedAudioFrame* audio_frame, 58 void InsertCodedAudioFrame(
60 const base::TimeTicks& recorded_time, 59 const transport::EncodedAudioFrame* audio_frame,
61 const base::Closure callback); 60 const base::TimeTicks& recorded_time,
61 const base::Closure callback);
62 62
63 // Only called from the main cast thread. 63 // Only called from the main cast thread.
64 void IncomingRtcpPacket(const uint8* packet, size_t length, 64 void IncomingRtcpPacket(const uint8* packet, size_t length,
65 const base::Closure callback); 65 const base::Closure callback);
66 66
67 protected: 67 protected:
68 void SendEncodedAudioFrame(scoped_ptr<EncodedAudioFrame> audio_frame, 68 void SendEncodedAudioFrame(
69 const base::TimeTicks& recorded_time); 69 scoped_ptr<transport::EncodedAudioFrame> audio_frame,
70 const base::TimeTicks& recorded_time);
70 71
71 private: 72 private:
72 friend class LocalRtcpAudioSenderFeedback; 73 friend class LocalRtcpAudioSenderFeedback;
73 74
74 void ResendPackets( 75 void ResendPackets(
75 const MissingFramesAndPacketsMap& missing_frames_and_packets); 76 const MissingFramesAndPacketsMap& missing_frames_and_packets);
76 77
77 // Caller must allocate the destination |encrypted_frame|. The data member 78 // Caller must allocate the destination |encrypted_frame|. The data member
78 // will be resized to hold the encrypted size. 79 // will be resized to hold the encrypted size.
79 bool EncryptAudioFrame(const EncodedAudioFrame& audio_frame, 80 bool EncryptAudioFrame(const transport::EncodedAudioFrame& audio_frame,
80 EncodedAudioFrame* encrypted_frame); 81 transport::EncodedAudioFrame* encrypted_frame);
81 82
82 void ScheduleNextRtcpReport(); 83 void ScheduleNextRtcpReport();
83 void SendRtcpReport(); 84 void SendRtcpReport();
84 85
85 void InitializeTimers(); 86 void InitializeTimers();
86 87
87 base::WeakPtrFactory<AudioSender> weak_factory_; 88 base::WeakPtrFactory<AudioSender> weak_factory_;
88 89
89 scoped_refptr<CastEnvironment> cast_environment_; 90 scoped_refptr<CastEnvironment> cast_environment_;
90 scoped_refptr<AudioEncoder> audio_encoder_; 91 scoped_refptr<AudioEncoder> audio_encoder_;
91 transport::RtpSender rtp_sender_; 92 transport::RtpSender rtp_sender_;
92 scoped_ptr<LocalRtpSenderStatistics> rtp_audio_sender_statistics_; 93 scoped_ptr<LocalRtpSenderStatistics> rtp_audio_sender_statistics_;
93 scoped_ptr<LocalRtcpAudioSenderFeedback> rtcp_feedback_; 94 scoped_ptr<LocalRtcpAudioSenderFeedback> rtcp_feedback_;
94 Rtcp rtcp_; 95 Rtcp rtcp_;
95 bool initialized_; 96 bool initialized_;
96 scoped_ptr<crypto::Encryptor> encryptor_; 97 scoped_ptr<crypto::Encryptor> encryptor_;
97 scoped_ptr<crypto::SymmetricKey> encryption_key_; 98 scoped_ptr<crypto::SymmetricKey> encryption_key_;
98 std::string iv_mask_; 99 std::string iv_mask_;
99 100
100 DISALLOW_COPY_AND_ASSIGN(AudioSender); 101 DISALLOW_COPY_AND_ASSIGN(AudioSender);
101 }; 102 };
102 103
103 } // namespace cast 104 } // namespace cast
104 } // namespace media 105 } // namespace media
105 106
106 #endif // MEDIA_CAST_AUDIO_SENDER_H_ 107 #endif // MEDIA_CAST_AUDIO_SENDER_H_
OLDNEW
« no previous file with comments | « media/cast/audio_sender/audio_encoder_unittest.cc ('k') | media/cast/audio_sender/audio_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698