| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1879 return static_cast<const VideoContentDescription*>( | 1879 return static_cast<const VideoContentDescription*>( |
| 1880 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); | 1880 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); |
| 1881 } | 1881 } |
| 1882 | 1882 |
| 1883 const DataContentDescription* GetFirstDataContentDescription( | 1883 const DataContentDescription* GetFirstDataContentDescription( |
| 1884 const SessionDescription* sdesc) { | 1884 const SessionDescription* sdesc) { |
| 1885 return static_cast<const DataContentDescription*>( | 1885 return static_cast<const DataContentDescription*>( |
| 1886 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); | 1886 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); |
| 1887 } | 1887 } |
| 1888 | 1888 |
| 1889 bool GetMediaChannelNameFromComponent( | |
| 1890 int component, MediaType media_type, std::string* channel_name) { | |
| 1891 if (media_type == MEDIA_TYPE_AUDIO) { | |
| 1892 if (component == ICE_CANDIDATE_COMPONENT_RTP) { | |
| 1893 *channel_name = GICE_CHANNEL_NAME_RTP; | |
| 1894 return true; | |
| 1895 } else if (component == ICE_CANDIDATE_COMPONENT_RTCP) { | |
| 1896 *channel_name = GICE_CHANNEL_NAME_RTCP; | |
| 1897 return true; | |
| 1898 } | |
| 1899 } else if (media_type == MEDIA_TYPE_VIDEO) { | |
| 1900 if (component == ICE_CANDIDATE_COMPONENT_RTP) { | |
| 1901 *channel_name = GICE_CHANNEL_NAME_VIDEO_RTP; | |
| 1902 return true; | |
| 1903 } else if (component == ICE_CANDIDATE_COMPONENT_RTCP) { | |
| 1904 *channel_name = GICE_CHANNEL_NAME_VIDEO_RTCP; | |
| 1905 return true; | |
| 1906 } | |
| 1907 } else if (media_type == MEDIA_TYPE_DATA) { | |
| 1908 if (component == ICE_CANDIDATE_COMPONENT_RTP) { | |
| 1909 *channel_name = GICE_CHANNEL_NAME_DATA_RTP; | |
| 1910 return true; | |
| 1911 } else if (component == ICE_CANDIDATE_COMPONENT_RTCP) { | |
| 1912 *channel_name = GICE_CHANNEL_NAME_DATA_RTCP; | |
| 1913 return true; | |
| 1914 } | |
| 1915 } | |
| 1916 | |
| 1917 return false; | |
| 1918 } | |
| 1919 | |
| 1920 bool GetMediaComponentFromChannelName( | |
| 1921 const std::string& channel_name, int* component) { | |
| 1922 if (channel_name == GICE_CHANNEL_NAME_RTP || | |
| 1923 channel_name == GICE_CHANNEL_NAME_VIDEO_RTP || | |
| 1924 channel_name == GICE_CHANNEL_NAME_DATA_RTP) { | |
| 1925 *component = ICE_CANDIDATE_COMPONENT_RTP; | |
| 1926 return true; | |
| 1927 } else if (channel_name == GICE_CHANNEL_NAME_RTCP || | |
| 1928 channel_name == GICE_CHANNEL_NAME_VIDEO_RTCP || | |
| 1929 channel_name == GICE_CHANNEL_NAME_DATA_RTP) { | |
| 1930 *component = ICE_CANDIDATE_COMPONENT_RTCP; | |
| 1931 return true; | |
| 1932 } | |
| 1933 | |
| 1934 return false; | |
| 1935 } | |
| 1936 | |
| 1937 bool GetMediaTypeFromChannelName( | |
| 1938 const std::string& channel_name, MediaType* media_type) { | |
| 1939 if (channel_name == GICE_CHANNEL_NAME_RTP || | |
| 1940 channel_name == GICE_CHANNEL_NAME_RTCP) { | |
| 1941 *media_type = MEDIA_TYPE_AUDIO; | |
| 1942 return true; | |
| 1943 } else if (channel_name == GICE_CHANNEL_NAME_VIDEO_RTP || | |
| 1944 channel_name == GICE_CHANNEL_NAME_VIDEO_RTCP) { | |
| 1945 *media_type = MEDIA_TYPE_VIDEO; | |
| 1946 return true; | |
| 1947 } else if (channel_name == GICE_CHANNEL_NAME_DATA_RTP || | |
| 1948 channel_name == GICE_CHANNEL_NAME_DATA_RTCP) { | |
| 1949 *media_type = MEDIA_TYPE_DATA; | |
| 1950 return true; | |
| 1951 } | |
| 1952 | |
| 1953 return false; | |
| 1954 } | |
| 1955 | |
| 1956 } // namespace cricket | 1889 } // namespace cricket |
| OLD | NEW |