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

Side by Side Diff: media/cast/cast_sender_impl.cc

Issue 1905763002: Convert //media/cast from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « media/cast/cast_sender_impl.h ('k') | media/cast/common/transport_encryption_handler.h » ('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/cast_sender_impl.h" 5 #include "media/cast/cast_sender_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 50
51 protected: 51 protected:
52 ~LocalVideoFrameInput() final {} 52 ~LocalVideoFrameInput() final {}
53 53
54 private: 54 private:
55 friend class base::RefCountedThreadSafe<LocalVideoFrameInput>; 55 friend class base::RefCountedThreadSafe<LocalVideoFrameInput>;
56 56
57 const scoped_refptr<CastEnvironment> cast_environment_; 57 const scoped_refptr<CastEnvironment> cast_environment_;
58 const base::WeakPtr<VideoSender> video_sender_; 58 const base::WeakPtr<VideoSender> video_sender_;
59 const scoped_ptr<VideoFrameFactory> video_frame_factory_; 59 const std::unique_ptr<VideoFrameFactory> video_frame_factory_;
60 60
61 DISALLOW_COPY_AND_ASSIGN(LocalVideoFrameInput); 61 DISALLOW_COPY_AND_ASSIGN(LocalVideoFrameInput);
62 }; 62 };
63 63
64 // The LocalAudioFrameInput class posts all incoming audio frames to the main 64 // The LocalAudioFrameInput class posts all incoming audio frames to the main
65 // cast thread for processing. Therefore frames can be inserted from any thread. 65 // cast thread for processing. Therefore frames can be inserted from any thread.
66 class LocalAudioFrameInput : public AudioFrameInput { 66 class LocalAudioFrameInput : public AudioFrameInput {
67 public: 67 public:
68 LocalAudioFrameInput(scoped_refptr<CastEnvironment> cast_environment, 68 LocalAudioFrameInput(scoped_refptr<CastEnvironment> cast_environment,
69 base::WeakPtr<AudioSender> audio_sender) 69 base::WeakPtr<AudioSender> audio_sender)
70 : cast_environment_(cast_environment), audio_sender_(audio_sender) {} 70 : cast_environment_(cast_environment), audio_sender_(audio_sender) {}
71 71
72 void InsertAudio(scoped_ptr<AudioBus> audio_bus, 72 void InsertAudio(std::unique_ptr<AudioBus> audio_bus,
73 const base::TimeTicks& recorded_time) final { 73 const base::TimeTicks& recorded_time) final {
74 cast_environment_->PostTask(CastEnvironment::MAIN, 74 cast_environment_->PostTask(CastEnvironment::MAIN,
75 FROM_HERE, 75 FROM_HERE,
76 base::Bind(&AudioSender::InsertAudio, 76 base::Bind(&AudioSender::InsertAudio,
77 audio_sender_, 77 audio_sender_,
78 base::Passed(&audio_bus), 78 base::Passed(&audio_bus),
79 recorded_time)); 79 recorded_time));
80 } 80 }
81 81
82 protected: 82 protected:
83 ~LocalAudioFrameInput() final {} 83 ~LocalAudioFrameInput() final {}
84 84
85 private: 85 private:
86 friend class base::RefCountedThreadSafe<LocalAudioFrameInput>; 86 friend class base::RefCountedThreadSafe<LocalAudioFrameInput>;
87 87
88 scoped_refptr<CastEnvironment> cast_environment_; 88 scoped_refptr<CastEnvironment> cast_environment_;
89 base::WeakPtr<AudioSender> audio_sender_; 89 base::WeakPtr<AudioSender> audio_sender_;
90 90
91 DISALLOW_COPY_AND_ASSIGN(LocalAudioFrameInput); 91 DISALLOW_COPY_AND_ASSIGN(LocalAudioFrameInput);
92 }; 92 };
93 93
94 scoped_ptr<CastSender> CastSender::Create( 94 std::unique_ptr<CastSender> CastSender::Create(
95 scoped_refptr<CastEnvironment> cast_environment, 95 scoped_refptr<CastEnvironment> cast_environment,
96 CastTransport* const transport_sender) { 96 CastTransport* const transport_sender) {
97 CHECK(cast_environment.get()); 97 CHECK(cast_environment.get());
98 return scoped_ptr<CastSender>( 98 return std::unique_ptr<CastSender>(
99 new CastSenderImpl(cast_environment, transport_sender)); 99 new CastSenderImpl(cast_environment, transport_sender));
100 } 100 }
101 101
102 CastSenderImpl::CastSenderImpl(scoped_refptr<CastEnvironment> cast_environment, 102 CastSenderImpl::CastSenderImpl(scoped_refptr<CastEnvironment> cast_environment,
103 CastTransport* const transport_sender) 103 CastTransport* const transport_sender)
104 : cast_environment_(cast_environment), 104 : cast_environment_(cast_environment),
105 transport_sender_(transport_sender), 105 transport_sender_(transport_sender),
106 weak_factory_(this) { 106 weak_factory_(this) {
107 CHECK(cast_environment.get()); 107 CHECK(cast_environment.get());
108 } 108 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 196 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
197 if (status == STATUS_INITIALIZED && !video_frame_input_) { 197 if (status == STATUS_INITIALIZED && !video_frame_input_) {
198 video_frame_input_ = 198 video_frame_input_ =
199 new LocalVideoFrameInput(cast_environment_, video_sender_->AsWeakPtr()); 199 new LocalVideoFrameInput(cast_environment_, video_sender_->AsWeakPtr());
200 } 200 }
201 status_change_cb.Run(status); 201 status_change_cb.Run(status);
202 } 202 }
203 203
204 } // namespace cast 204 } // namespace cast
205 } // namespace media 205 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/cast_sender_impl.h ('k') | media/cast/common/transport_encryption_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698