Skip to content

Commit

Permalink
Revert of Initialize default audio device ID with explicit device ID.…
Browse files Browse the repository at this point in the history
… (patchset #4 id:170001 of https://codereview.chromium.org/2809043004/ )

Reason for revert:
Causes http://crbug.com/714386

Original issue's description:
> Reland of Initialize default audio device ID with explicit device ID. (patchset #1 id:1 of https://codereview.chromium.org/2813543005/ )
>
> Reason for revert:
> Will attempt to reland by reverting changes in MSM and updating extensions test.
>
> Original issue's description:
> > Revert of Initialize default audio device ID with explicit device ID. (patchset #2 id:20001 of https://codereview.chromium.org/2812903002/ )
> >
> > Reason for revert:
> > Patchset 2 restores the behavior I wanted to eliminate.
> >
> > Original issue's description:
> > > Initialize default audio device ID with explicit device ID.
> > >
> > > This is more consistent with how video device IDs are specified and is
> > > also a small first step towards implementing the standard constraints
> > > algorithm for audio.
> > > This CL disables a misleading selector that allows switching the
> > > user-preferred device in the middle of a getUserMedia call.
> > > Since that selector does not affect the current getUserMedia call, it
> > > is better to have it disabled, which is already the case with video
> > > devices.
> > >
> > > BUG=708081
> > >
> > > Review-Url: https://codereview.chromium.org/2812903002
> > > Cr-Commit-Position: refs/heads/master@{#463624}
> > > Committed: https://chromium.googlesource.com/chromium/src/+/82382cca8c9aa804acb7fd9cfaa6e4478f92cd7d
> >
> > TBR=hbos@chromium.org
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > BUG=708081
> >
> > Review-Url: https://codereview.chromium.org/2813543005
> > Cr-Commit-Position: refs/heads/master@{#463634}
> > Committed: https://chromium.googlesource.com/chromium/src/+/cf8ea8d590f1c89c2633c793a41bd31a85b3fe72
>
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=708081
>
> Review-Url: https://codereview.chromium.org/2809043004
> Cr-Commit-Position: refs/heads/master@{#463710}
> Committed: https://chromium.googlesource.com/chromium/src/+/be26518ed4e8a2966c919a93b488689374b17d42

TBR=mek@chromium.org
BUG=708081,714386

Review-Url: https://codereview.chromium.org/2829403002
Cr-Commit-Position: refs/heads/master@{#466550}
(cherry picked from commit 18633fc)

Review-Url: https://codereview.chromium.org/2837873004 .
Cr-Commit-Position: refs/branch-heads/3071@{#194}
Cr-Branched-From: a106f0a-refs/heads/master@{#464641}
  • Loading branch information
Guido Urdaneta committed Apr 25, 2017
1 parent a35ca90 commit 4f7111b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 22 deletions.
9 changes: 1 addition & 8 deletions content/renderer/media/user_media_client_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "content/renderer/media/webrtc_logging.h"
#include "content/renderer/media/webrtc_uma_histograms.h"
#include "content/renderer/render_thread_impl.h"
#include "media/audio/audio_device_description.h"
#include "media/capture/video_capture_types.h"
#include "third_party/WebKit/public/platform/WebMediaConstraints.h"
#include "third_party/WebKit/public/platform/WebMediaDeviceInfo.h"
Expand Down Expand Up @@ -86,7 +85,7 @@ bool PickDeviceId(const blink::WebMediaConstraints& constraints,
const MediaDeviceInfoArray& device_infos,
std::string* device_id) {
DCHECK(!constraints.IsNull());
DCHECK(media::AudioDeviceDescription::IsDefaultDevice(*device_id));
DCHECK(device_id->empty());

if (constraints.Basic().device_id.Exact().size() > 1) {
LOG(ERROR) << "Only one required device ID is supported";
Expand Down Expand Up @@ -399,12 +398,6 @@ void UserMediaClientImpl::MaybeProcessNextRequestInfo() {
current_request_info_->request().AudioConstraints(),
&current_request_info_->stream_controls()->audio,
&request_audio_input_devices);
// Explicitly initialize the requested device ID to the default.
if (IsDeviceSource(
current_request_info_->stream_controls()->audio.stream_source)) {
current_request_info_->stream_controls()->audio.device_id =
std::string(media::AudioDeviceDescription::kDefaultDeviceId);
}
CopyHotwordAndLocalEchoToStreamControls(
current_request_info_->request().AudioConstraints(),
current_request_info_->stream_controls());
Expand Down
8 changes: 3 additions & 5 deletions content/renderer/media/user_media_client_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "content/renderer/media/mock_media_stream_dispatcher.h"
#include "content/renderer/media/mock_media_stream_video_source.h"
#include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory.h"
#include "media/audio/audio_device_description.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/public/platform/WebMediaDeviceInfo.h"
Expand Down Expand Up @@ -901,12 +900,11 @@ TEST_F(UserMediaClientImplTest, CreateWithAllOptionalInvalidDeviceId) {
CreateDeviceConstraints(nullptr, kInvalidDeviceId, kInvalidDeviceId);
blink::WebMediaConstraints video_constraints =
CreateDeviceConstraints(nullptr, kInvalidDeviceId, kInvalidDeviceId);
// MockMediaStreamDispatcher uses empty string as default audio device ID.
// MockMediaDevicesDispatcher uses the first device in the enumeration as
// default video device ID.
TestValidRequestWithConstraints(
audio_constraints, video_constraints,
std::string(media::AudioDeviceDescription::kDefaultDeviceId),
kFakeVideoInputDeviceId1);
TestValidRequestWithConstraints(audio_constraints, video_constraints,
std::string(), kFakeVideoInputDeviceId1);
}

TEST_F(UserMediaClientImplTest, CreateWithFacingModeUser) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/command_line.h"
#include "base/macros.h"
#include "base/strings/stringprintf.h"
#include "content/public/browser/web_contents_delegate.h"
Expand Down Expand Up @@ -81,14 +80,6 @@ class WebViewMediaAccessAPITest : public WebViewAPITest {
base::StringPrintf("runTest('%s');", test_name.c_str())));
ASSERT_TRUE(test_run_listener.WaitUntilSatisfied());
}

void SetUpCommandLine(base::CommandLine* command_line) override {
WebViewAPITest::SetUpCommandLine(command_line);
// This switch ensures that there will always be at least one media device,
// even on machines without physical devices. This is required by tests that
// request permission to use media devices.
command_line->AppendSwitch("use-fake-device-for-media-stream");
}
};

IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllow) {
Expand Down

0 comments on commit 4f7111b

Please sign in to comment.