OLD | NEW |
---|---|
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2135 | 2135 |
2136 void WebRtcVideoChannel2::WebRtcVideoSendStream::SetDimensions( | 2136 void WebRtcVideoChannel2::WebRtcVideoSendStream::SetDimensions( |
2137 int width, | 2137 int width, |
2138 int height, | 2138 int height, |
2139 bool is_screencast) { | 2139 bool is_screencast) { |
2140 if (last_dimensions_.width == width && last_dimensions_.height == height && | 2140 if (last_dimensions_.width == width && last_dimensions_.height == height && |
2141 last_dimensions_.is_screencast == is_screencast) { | 2141 last_dimensions_.is_screencast == is_screencast) { |
2142 // Configured using the same parameters, do not reconfigure. | 2142 // Configured using the same parameters, do not reconfigure. |
2143 return; | 2143 return; |
2144 } | 2144 } |
2145 bool switched_content_type = last_dimensions_.is_screencast != is_screencast; | |
2145 LOG(LS_INFO) << "SetDimensions: " << width << "x" << height | 2146 LOG(LS_INFO) << "SetDimensions: " << width << "x" << height |
2146 << (is_screencast ? " (screencast)" : " (not screencast)"); | 2147 << (is_screencast ? " (screencast)" : " (not screencast)"); |
2147 | 2148 |
2148 last_dimensions_.width = width; | 2149 last_dimensions_.width = width; |
2149 last_dimensions_.height = height; | 2150 last_dimensions_.height = height; |
2150 last_dimensions_.is_screencast = is_screencast; | 2151 last_dimensions_.is_screencast = is_screencast; |
2151 | 2152 |
2153 if (switched_content_type) { | |
2154 // If we change content type, reset entire stream so that state is reset | |
2155 // (stats flushed etc). | |
2156 RecreateWebRtcStream(); | |
mflodman
2015/12/02 08:59:13
As I read the code, this will generate a new seque
mflodman
2015/12/02 09:12:25
Now I agree this seems to work, given the magic in
| |
2157 } | |
2158 | |
2152 RTC_DCHECK(!parameters_.encoder_config.streams.empty()); | 2159 RTC_DCHECK(!parameters_.encoder_config.streams.empty()); |
2153 | 2160 |
2154 RTC_CHECK(parameters_.codec_settings); | 2161 RTC_CHECK(parameters_.codec_settings); |
2155 VideoCodecSettings codec_settings = *parameters_.codec_settings; | 2162 VideoCodecSettings codec_settings = *parameters_.codec_settings; |
2156 | 2163 |
2157 webrtc::VideoEncoderConfig encoder_config = | 2164 webrtc::VideoEncoderConfig encoder_config = |
2158 CreateVideoEncoderConfig(last_dimensions_, codec_settings.codec); | 2165 CreateVideoEncoderConfig(last_dimensions_, codec_settings.codec); |
2159 | 2166 |
2160 encoder_config.encoder_specific_settings = ConfigureVideoEncoderSettings( | 2167 encoder_config.encoder_specific_settings = ConfigureVideoEncoderSettings( |
2161 codec_settings.codec, parameters_.options, is_screencast); | 2168 codec_settings.codec, parameters_.options, is_screencast); |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2744 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; | 2751 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; |
2745 } | 2752 } |
2746 } | 2753 } |
2747 | 2754 |
2748 return video_codecs; | 2755 return video_codecs; |
2749 } | 2756 } |
2750 | 2757 |
2751 } // namespace cricket | 2758 } // namespace cricket |
2752 | 2759 |
2753 #endif // HAVE_WEBRTC_VIDEO | 2760 #endif // HAVE_WEBRTC_VIDEO |
OLD | NEW |