docstr: If input rate/channels are not supported, encoder picks supported one automatically.
docstr_tok: ["If","input","rate\/channels","are","not","supported",",","encoder","picks","supported","one","automatically","."]
code: def test_change_encoder_spec_default(
      self,
      ext,
      encoder,
      src_sr,
      expected_sr,
      src_num_channels,
      expected_num_channels,
  ):
      """If input rate/channels are not supported, encoder picks supported one automatically."""
      filename = f"test.{ext}"
  
      original = get_sinusoid(
          sample_rate=src_sr,
          n_channels=src_num_channels,
          channels_first=False,
          duration=0.1,
      )
  
      dst = self.get_temp_path(filename)
      w = StreamWriter(dst, format=ext)
      w.add_audio_stream(
          sample_rate=src_sr,
          format="flt",
          num_channels=src_num_channels,
          encoder=encoder,
      )
  
      with w.open():
          w.write_audio_chunk(0, original)
  
      # check
      reader = torchaudio.io.StreamReader(
          src=self.get_temp_path(filename)
      )
      i = reader.get_src_stream_info(0)
      self.assertEqual(i.sample_rate, expected_sr)
      self.assertEqual(i.num_channels, expected_num_channels)
  
imports: import io
  import math
  import torch
  import torchaudio
  from parameterized import parameterized, parameterized_class
  from torchaudio.io import CodecConfig, StreamReader, StreamWriter
  from torchaudio_unittest.common_utils import get_asset_path, get_sinusoid, nested_params, rgb_to_yuv_ccir, skipIfNoFFmpeg, skipIfNoModule, TempDirMixin, TorchaudioTestCase
  from .common import lt42
label_desc: Use image node_id 17 for calling the StreamWriterCorrectnessTest obj's underlying member method code with example usage: obj.test_change_encoder_spec_default(ext, encoder, src_sr, expected_sr, src_num_channels, expected_num_channels) without return types