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

Side by Side Diff: media/remoting/fake_remoter.cc

Issue 2643253003: Media Remoting Clean-up: Less-redundant naming, style consistency, etc. (Closed)
Patch Set: REBASE Created 3 years, 10 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/remoting/fake_remoter.h ('k') | media/remoting/fake_remoting_controller.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/remoting/fake_remoting_controller.h" 5 #include "media/remoting/fake_remoter.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/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
12 #include "media/remoting/remoting_source_impl.h" 12 #include "media/remoting/proto_utils.h"
13 #include "media/remoting/rpc/proto_utils.h" 13 #include "media/remoting/shared_session.h"
14 #include "mojo/public/cpp/bindings/strong_binding.h" 14 #include "mojo/public/cpp/bindings/strong_binding.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace media { 17 namespace media {
18 namespace remoting {
18 19
19 FakeRemotingDataStreamSender::FakeRemotingDataStreamSender( 20 FakeRemotingDataStreamSender::FakeRemotingDataStreamSender(
20 mojom::RemotingDataStreamSenderRequest request, 21 mojom::RemotingDataStreamSenderRequest request,
21 mojo::ScopedDataPipeConsumerHandle consumer_handle) 22 mojo::ScopedDataPipeConsumerHandle consumer_handle)
22 : binding_(this, std::move(request)), 23 : binding_(this, std::move(request)),
23 consumer_handle_(std::move(consumer_handle)), 24 consumer_handle_(std::move(consumer_handle)),
24 consume_data_chunk_count_(0), 25 consume_data_chunk_count_(0),
25 send_frame_count_(0), 26 send_frame_count_(0),
26 cancel_in_flight_count_(0) {} 27 cancel_in_flight_count_(0) {}
27 28
(...skipping 10 matching lines...) Expand all
38 bool FakeRemotingDataStreamSender::ValidateFrameBuffer(size_t index, 39 bool FakeRemotingDataStreamSender::ValidateFrameBuffer(size_t index,
39 size_t size, 40 size_t size,
40 bool key_frame, 41 bool key_frame,
41 int pts_ms) { 42 int pts_ms) {
42 if (index >= received_frame_list.size()) { 43 if (index >= received_frame_list.size()) {
43 VLOG(1) << "There is no such frame"; 44 VLOG(1) << "There is no such frame";
44 return false; 45 return false;
45 } 46 }
46 47
47 const std::vector<uint8_t>& data = received_frame_list[index]; 48 const std::vector<uint8_t>& data = received_frame_list[index];
48 scoped_refptr<::media::DecoderBuffer> media_buffer = 49 scoped_refptr<DecoderBuffer> media_buffer =
49 remoting::ByteArrayToDecoderBuffer(data.data(), data.size()); 50 ByteArrayToDecoderBuffer(data.data(), data.size());
50 51
51 // Checks if pts is correct or not 52 // Checks if pts is correct or not
52 if (media_buffer->timestamp().InMilliseconds() != pts_ms) { 53 if (media_buffer->timestamp().InMilliseconds() != pts_ms) {
53 VLOG(1) << "Pts should be:" << pts_ms << "(" 54 VLOG(1) << "Pts should be:" << pts_ms << "("
54 << media_buffer->timestamp().InMilliseconds() << ")"; 55 << media_buffer->timestamp().InMilliseconds() << ")";
55 return false; 56 return false;
56 } 57 }
57 58
58 // Checks if key frame is set correct or not 59 // Checks if key frame is set correct or not
59 if (media_buffer->is_key_frame() != key_frame) { 60 if (media_buffer->is_key_frame() != key_frame) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 169
169 FakeRemoterFactory::~FakeRemoterFactory() {} 170 FakeRemoterFactory::~FakeRemoterFactory() {}
170 171
171 void FakeRemoterFactory::Create(mojom::RemotingSourcePtr source, 172 void FakeRemoterFactory::Create(mojom::RemotingSourcePtr source,
172 mojom::RemoterRequest request) { 173 mojom::RemoterRequest request) {
173 mojo::MakeStrongBinding( 174 mojo::MakeStrongBinding(
174 base::MakeUnique<FakeRemoter>(std::move(source), start_will_fail_), 175 base::MakeUnique<FakeRemoter>(std::move(source), start_will_fail_),
175 std::move(request)); 176 std::move(request));
176 } 177 }
177 178
178 scoped_refptr<RemotingSourceImpl> CreateRemotingSourceImpl( 179 // static
180 scoped_refptr<SharedSession> FakeRemoterFactory::CreateSharedSession(
179 bool start_will_fail) { 181 bool start_will_fail) {
180 mojom::RemotingSourcePtr remoting_source; 182 mojom::RemotingSourcePtr remoting_source;
181 mojom::RemotingSourceRequest remoting_source_request(&remoting_source); 183 mojom::RemotingSourceRequest remoting_source_request(&remoting_source);
182 mojom::RemoterPtr remoter; 184 mojom::RemoterPtr remoter;
183 std::unique_ptr<mojom::RemoterFactory> remoter_factory = 185 FakeRemoterFactory remoter_factory(start_will_fail);
184 base::MakeUnique<FakeRemoterFactory>(start_will_fail); 186 remoter_factory.Create(std::move(remoting_source),
185 remoter_factory->Create(std::move(remoting_source), 187 mojo::MakeRequest(&remoter));
186 mojo::MakeRequest(&remoter)); 188 return new SharedSession(std::move(remoting_source_request),
187 return new RemotingSourceImpl(std::move(remoting_source_request), 189 std::move(remoter));
188 std::move(remoter));
189 } 190 }
190 191
192 } // namespace remoting
191 } // namespace media 193 } // namespace media
OLDNEW
« no previous file with comments | « media/remoting/fake_remoter.h ('k') | media/remoting/fake_remoting_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698