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

Side by Side Diff: webrtc/api/android/java/src/org/webrtc/MediaConstraints.java

Issue 2547483003: Move /webrtc/api/android files to /webrtc/sdk/android (Closed)
Patch Set: Move to api folder under Android instead of src Created 4 years 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
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 package org.webrtc;
12
13 import java.util.LinkedList;
14 import java.util.List;
15
16 /**
17 * Description of media constraints for {@code MediaStream} and
18 * {@code PeerConnection}.
19 */
20 public class MediaConstraints {
21 /** Simple String key/value pair. */
22 public static class KeyValuePair {
23 private final String key;
24 private final String value;
25
26 public KeyValuePair(String key, String value) {
27 this.key = key;
28 this.value = value;
29 }
30
31 public String getKey() {
32 return key;
33 }
34
35 public String getValue() {
36 return value;
37 }
38
39 public String toString() {
40 return key + ": " + value;
41 }
42
43 @Override
44 public boolean equals(Object other) {
45 if (this == other) {
46 return true;
47 }
48 if (other == null || getClass() != other.getClass()) {
49 return false;
50 }
51 KeyValuePair that = (KeyValuePair) other;
52 return key.equals(that.key) && value.equals(that.value);
53 }
54
55 @Override
56 public int hashCode() {
57 return key.hashCode() + value.hashCode();
58 }
59 }
60
61 public final List<KeyValuePair> mandatory;
62 public final List<KeyValuePair> optional;
63
64 public MediaConstraints() {
65 mandatory = new LinkedList<KeyValuePair>();
66 optional = new LinkedList<KeyValuePair>();
67 }
68
69 private static String stringifyKeyValuePairList(List<KeyValuePair> list) {
70 StringBuilder builder = new StringBuilder("[");
71 for (KeyValuePair pair : list) {
72 if (builder.length() > 1) {
73 builder.append(", ");
74 }
75 builder.append(pair.toString());
76 }
77 return builder.append("]").toString();
78 }
79
80 public String toString() {
81 return "mandatory: " + stringifyKeyValuePairList(mandatory) + ", optional: "
82 + stringifyKeyValuePairList(optional);
83 }
84 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698