OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/media/mock_media_stream_dispatcher.h" | 5 #include "content/renderer/media/mock_media_stream_dispatcher.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "content/public/common/media_stream_request.h" | 8 #include "content/public/common/media_stream_request.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... | |
21 | 21 |
22 MockMediaStreamDispatcher::~MockMediaStreamDispatcher() {} | 22 MockMediaStreamDispatcher::~MockMediaStreamDispatcher() {} |
23 | 23 |
24 void MockMediaStreamDispatcher::GenerateStream( | 24 void MockMediaStreamDispatcher::GenerateStream( |
25 int request_id, | 25 int request_id, |
26 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, | 26 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, |
27 const StreamOptions& components, | 27 const StreamOptions& components, |
28 const GURL& url) { | 28 const GURL& url) { |
29 request_id_ = request_id; | 29 request_id_ = request_id; |
30 | 30 |
31 stream_label_ = base::StringPrintf("%s%d","local_stream",request_id); | 31 stream_label_ = base::StringPrintf("%s%d", "local_stream", request_id); |
tommi (sloooow) - chröme
2013/10/29 17:21:17
why are we using %s to print "local_stream"?
perkj_chrome
2013/10/30 08:59:29
because its fun?
| |
32 audio_array_.clear(); | 32 audio_array_.clear(); |
33 video_array_.clear(); | 33 video_array_.clear(); |
34 | 34 |
35 if (IsAudioMediaType(components.audio_type)) { | 35 if (IsAudioMediaType(components.audio_type)) { |
36 StreamDeviceInfo audio; | 36 StreamDeviceInfo audio; |
37 audio.device.id = "audio_device_id"; | 37 audio.device.id = base::StringPrintf("%s%d", "audio_device_id", |
38 session_id_); | |
tommi (sloooow) - chröme
2013/10/29 17:21:17
same here
perkj_chrome
2013/10/30 08:59:29
Done.
| |
38 audio.device.name = "microphone"; | 39 audio.device.name = "microphone"; |
39 audio.device.type = components.audio_type; | 40 audio.device.type = components.audio_type; |
40 audio.session_id = session_id_; | 41 audio.session_id = session_id_; |
41 audio_array_.push_back(audio); | 42 audio_array_.push_back(audio); |
42 } | 43 } |
43 if (IsVideoMediaType(components.video_type)) { | 44 if (IsVideoMediaType(components.video_type)) { |
44 StreamDeviceInfo video; | 45 StreamDeviceInfo video; |
45 video.device.id = "video_device_id"; | 46 video.device.id = base::StringPrintf("%s%d", "video_device_id", |
47 session_id_); | |
tommi (sloooow) - chröme
2013/10/29 17:21:17
and here :)
fyi there's also another way to conver
perkj_chrome
2013/10/30 08:59:29
ok- maybe that is more readable.
| |
46 video.device.name = "usb video camera"; | 48 video.device.name = "usb video camera"; |
47 video.device.type = components.video_type; | 49 video.device.type = components.video_type; |
48 video.session_id = session_id_; | 50 video.session_id = session_id_; |
49 video_array_.push_back(video); | 51 video_array_.push_back(video); |
50 } | 52 } |
51 ++request_stream_counter_; | 53 ++request_stream_counter_; |
52 } | 54 } |
53 | 55 |
54 void MockMediaStreamDispatcher::CancelGenerateStream( | 56 void MockMediaStreamDispatcher::CancelGenerateStream( |
55 int request_id, | 57 int request_id, |
(...skipping 22 matching lines...) Expand all Loading... | |
78 int index) { | 80 int index) { |
79 return -1; | 81 return -1; |
80 } | 82 } |
81 | 83 |
82 int MockMediaStreamDispatcher::audio_session_id(const std::string& label, | 84 int MockMediaStreamDispatcher::audio_session_id(const std::string& label, |
83 int index) { | 85 int index) { |
84 return -1; | 86 return -1; |
85 } | 87 } |
86 | 88 |
87 } // namespace content | 89 } // namespace content |
OLD | NEW |