<p>
default video quality to 176x144 20fps 500Kbps<br/>
default audio quality to 16 000 sampleRate 272000 bitRate
</p>
199236
public void configureForPublish( Context context, SurfaceView mSurfaceView, DisplayOrientation orientation )
  {
    session = getSession( context, mSurfaceView, orientation.getValue() );
    rtspClient = getRtspClient( context, session );
  }
258567
private VideoFormat getSizedVideoFormat(Dimension size) {

		Format[] formats = device.getFormats();
		VideoFormat format = null;

		for (Format f : formats) {

			if (!"RGB".equalsIgnoreCase(f.getEncoding()) || !(f instanceof VideoFormat)) {
				continue;
			}

			Dimension d = ((VideoFormat) f).getSize();
			if (d.width == size.width && d.height == size.height) {
				format = (VideoFormat) f;
				break;
			}
		}

		return format;
	}
770657
function(ql) {
				var fm       = ql.fm,
			preview  = ql.preview,
			mimes    = {
				'audio/mpeg'    : 'mp3',
				'audio/mpeg3'   : 'mp3',
				'audio/mp3'     : 'mp3',
				'audio/x-mpeg3' : 'mp3',
				'audio/x-mp3'   : 'mp3',
				'audio/x-wav'   : 'wav',
				'audio/wav'     : 'wav',
				'audio/x-m4a'   : 'm4a',
				'audio/aac'     : 'm4a',
				'audio/mp4'     : 'm4a',
				'audio/x-mp4'   : 'm4a',
				'audio/ogg'     : 'ogg',
				'audio/webm'    : 'webm',
				'audio/flac'    : 'flac',
				'audio/x-flac'  : 'flac',
				'audio/amr'     : 'amr'
			},
			node, curHash,
			win  = ql.window,
			navi = ql.navbar,
			AMR, autoplay,
			setNavi = function() {
				navi.css('bottom', win.hasClass('elfinder-quicklook-fullscreen')? '50px' : '');
			},
			getNode = function(src, hash) {
				return $('<audio class="elfinder-quicklook-preview-audio ui-front" controls preload="auto" autobuffer><source src="'+src+'" /></audio>')
					.on('change', function(e) {
						// Firefox fire change event on seek or volume change
						e.stopPropagation();
					})
					.on('error', function(e) {
						node && node.data('hash') === hash && reset();
					})
					.data('hash', hash)
					.appendTo(preview);
			},
			amrToWavUrl = function(hash) {
				var dfd = $.Deferred(),
					loader = $.Deferred().done(function() {
						fm.getContents(hash).done(function(data) {
							try {
								var buffer = AMR.toWAV(new Uint8Array(data));
								if (buffer) {
									dfd.resolve(URL.createObjectURL(new Blob([buffer], { type: 'audio/x-wav' })));
								} else {
									dfd.reject();
								}
							} catch(e) {
								dfd.reject();
							}
						}).fail(function() {
							dfd.reject();
						});
					}).fail(function() {
						AMR = false;
						dfd.reject();
					}),
					_AMR;
				if (window.TextEncoder && window.URL && URL.createObjectURL && typeof AMR === 'undefined') {
					// previous window.AMR
					_AMR = window.AMR;
					delete window.AMR;
					fm.loadScript(
						[ fm.options.cdns.amr ],
						function() { 
							AMR = window.AMR? window.AMR : false;
							// restore previous window.AMR
							window.AMR = _AMR;
							loader[AMR? 'resolve':'reject']();
						},
						{
							error: function() {
								loader.reject();
							}
						}
					);
				} else {
					loader[AMR? 'resolve':'reject']();
				}
				return dfd;
			},
			play = function(player) {
				var hash = node.data('hash'),
					playPromise;
				autoplay && (playPromise = player.play());
				if (playPromise && playPromise.catch) {
					playPromise.catch(function(e) {
						if (!player.paused) {
							node && node.data('hash') === hash && reset();
						}
					});
				}
			},
			reset = function() {
				if (node && node.parent().length) {
					var elm = node[0],
						url = node.children('source').attr('src');
					win.off('viewchange.audio');
					try {
						elm.pause();
						node.empty();
						if (url.match(/^blob:/)) {
							URL.revokeObjectURL(url);
						}
						elm.src = '';
						elm.load();
					} catch(e) {}
					node.remove();
					node = null;
				}
			};

		preview.on(ql.evUpdate, function(e) {
			var file = e.file,
				type = mimes[file.mime],
				html5, srcUrl;

			if (mimes[file.mime] && ql.dispInlineRegex.test(file.mime) && ((html5 = ql.support.audio[type]) || (type === 'amr'))) {
				autoplay = ql.autoPlay();
				curHash = file.hash;
				srcUrl = html5? fm.openUrl(curHash) : '';
				if (!html5) {
					if (fm.options.cdns.amr && type === 'amr' && AMR !== false) {
						e.stopImmediatePropagation();
						node = getNode(srcUrl, curHash);
						amrToWavUrl(file.hash).done(function(url) {
							if (curHash === file.hash) {
								var elm = node[0];
								try {
									node.children('source').attr('src', url);
									elm.pause();
									elm.load();
									play(elm);
									win.on('viewchange.audio', setNavi);
									setNavi();
								} catch(e) {
									URL.revokeObjectURL(url);
									node.remove();
								}
							} else {
								URL.revokeObjectURL(url);
							}
						}).fail(function() {
							node.remove();
						});
					}
				} else {
					e.stopImmediatePropagation();
					node = getNode(srcUrl, curHash);
					play(node[0]);
					win.on('viewchange.audio', setNavi);
					setNavi();
				}
			}
		}).on('change', reset);
	}
970648
private static int[][] createSampleRateTable() {
        int[][] arr = new int[4][];
        arr[AudioFrame.MPEG_V1] = SAMPLE_RATE_MPEG1;
        arr[AudioFrame.MPEG_V2] = SAMPLE_RATE_MPEG2;
        arr[AudioFrame.MPEG_V2_5] = SAMPLE_RATE_MPEG2_5;
        return arr;
    }
303540
def makeAudibleSong(self):
        
        sound0=n.hstack((sy.render(220,d=1.5),
                        sy.render(220*(2**(7/12)),d=2.5),
                        sy.render(220*(2**(-5/12)),d=.5),
                        sy.render(220*(2**(0/12)),d=1.5),
                        ))
        sound1=n.hstack((sy.render(220*(2**(0/12)),d=.25),
                         sy.render(220*(2**(7/12)),d=.25),
                         sy.render(220*(2**(0/12)),d=.25),
                         sy.render(220*(2**(7/12)),d=.25),
                         sy.render(220*(2**(0/12)),d=.25),
                         sy.render(220*(2**(7/12)),d=.25),
                         sy.render(220*(2**(0/12)),d=.25),
                         sy.render(220*(2**(7/12)),d=.25),
                        ))
        sound2=n.hstack((sy.render(220*(2**(0/12)),d=.75),
                         sy.render(220*(2**(0/12)),d=.25),
                         sy.render(220*(2**(7/12)),d=.75),
                         sy.render(220*(2**(0/12)),d=.25),
                         sy.render(220*(2**(-1/12)),d=2.0),
                       ))
        sound3=n.hstack((n.zeros(44100),
                         sy.render(220*(2**(-1/12)),d=.5),
                         sy.render(220*(2**(8/12)),d=2.),
                         sy.render(220*(2**(8/12)),d=.25),
                         sy.render(220*(2**(8/12)),d=.25),
                         sy.render(220*(2**(-1/12)),d=1.75),
                         sy.render(220*(2**(-1/12)),d=.25),
                       ))
        sound4=n.hstack((
                         sy.render(220*(2**(0/12)),d=1.),
                         sy.render(220*(2**(7/12)),d=.5),
                         sy.render(220*(2**(11/12)),d=.5),
                         sy.render(220*(2**(12/12)),d=.75),
                         sy.render(220*(2**(11/12)),d=.25),
                         sy.render(220*(2**(12/12)),d=1.),
                         sy.render(220*(2**(8/12)),d=2.),
                         sy.render(220*(2**(7/12)),d=2.),
                         sy.render(220*(2**(-1/12)),d=2.),
                         n.zeros(2*44100)
                       ))

        sound=n.hstack((sound0,sound1,sound2,sound3,sound4))
        UT.write(sound,"sound.wav")
756840
def audiorate(filename):
    
    if '.wav' in filename.lower():
        wf = wave.open(filename)
        fs = wf.getframerate()
        wf.close()
    elif '.call' in filename.lower():
        fs = 333333
    else:
        raise IOError("Unsupported audio format for file: {}".format(filename))

    return fs
452912
private static int calculateFrameLength(int layer, int bitRate, int sampleRate, int padding) {
        if (layer == AudioFrame.LAYER_1) {
            return (12 * bitRate / sampleRate + padding) * 4;
        } else {
            return 144 * bitRate / sampleRate + padding;
        }
    }
1210444
private static AudioFrame createHeader(HeaderBitField bits) {
        if (bits.get(21, 23) != 7) {
            return null;
        }
        int mpegVer = bits.get(19, 20);
        int layer = bits.get(17, 18);
        int bitRateCode = bits.get(12, 15);
        int sampleRateCode = bits.get(10, 11);
        int padding = bits.get(9);
        if (mpegVer == 1 || layer == 0 || bitRateCode == 0 || bitRateCode == 15 || sampleRateCode == 3) {
            // invalid header values
            return null;
        }
        int bitRate = calculateBitRate(mpegVer, layer, bitRateCode);
        int sampleRate = calculateSampleRate(mpegVer, sampleRateCode);
        int length = calculateFrameLength(layer, bitRate, sampleRate, padding);
        float duration = calculateDuration(layer, sampleRate);
        int channels = calculateChannels(bits.get(6, 7));
        return new AudioFrame(mpegVer, layer, bitRate, sampleRate, channels, length, duration);
    }
1263845
public T setVideoFrameRate(Fraction frame_rate) {
    this.video_enabled = true;
    this.video_frame_rate = checkNotNull(frame_rate);
    return getThis();
  }
653429
function(data) {
      var
        view = new DataView(data.buffer, data.byteOffset, data.byteLength),
        result = {
          // 6 bytes reserved
          dataReferenceIndex: view.getUint16(6),
          // 4 + 4 bytes reserved
          channelcount: view.getUint16(16),
          samplesize: view.getUint16(18),
          // 2 bytes pre_defined
          // 2 bytes reserved
          samplerate: view.getUint16(24) + (view.getUint16(26) / 65536)
        };

      // if there are more bytes to process, assume this is an ISO/IEC
      // 14496-14 MP4AudioSampleEntry and parse the ESDBox
      if (data.byteLength > 28) {
        result.streamDescriptor = inspectMp4(data.subarray(28))[0];
      }
      return result;
    }
407574
function(ffmpeg, cb) {
        if (ffmpeg.length) {
          return cb(null, ffmpeg);
        }

        utils.which('ffmpeg', function(err, ffmpeg) {
          cb(err, ffmpeg);
        });
      }
736643
protected void nativePlay(Element video) {
        MediaStream stream = null;
        if (Navigator.getUserMedia != null) {
            stream = Navigator.getUserMedia;
            GWT.log("Uses Default user Media");
        } else if (Navigator.webkitGetUserMedia != null) {
            stream = Navigator.webkitGetUserMedia;
            GWT.log("Uses Webkit User Media");
        } else if (Navigator.mozGetUserMedia != null) {
            stream = Navigator.mozGetUserMedia;
            GWT.log("Uses Moz User Media");
        } else if (Navigator.msGetUserMedia != null) {
            stream = Navigator.msGetUserMedia;
            GWT.log("Uses Microsoft user Media");
        } else {
            GWT.log("No supported media found in your browser");
        }

        if (stream != null) {
            Navigator.getMedia = stream;
            Constraints constraints = new Constraints();
            constraints.audio = false;

            MediaTrackConstraints mediaTrackConstraints = new MediaTrackConstraints();
            mediaTrackConstraints.width = width;
            mediaTrackConstraints.height = height;
            mediaTrackConstraints.facingMode = facingMode.getName();
            constraints.video = mediaTrackConstraints;

            Navigator.mediaDevices.getUserMedia(constraints).then(streamObj -> {
                mediaStream = (MediaStream) streamObj;
                if (URL.createObjectURL(mediaStream) != null) {
                    $(video).attr("src", URL.createObjectURL(mediaStream));
                } else if (WebkitURL.createObjectURL(mediaStream) != null) {
                    $(video).attr("src", WebkitURL.createObjectURL(mediaStream));
                }
                if (video instanceof VideoElement) {
                    ((VideoElement) video).play();
                }
                onCameraCaptureLoad();
                return null;
            }).catchException(error -> {
                GWT.log("MaterialCameraCapture: An error occured! " + error);
                onCameraCaptureError(error.toString());
                return null;
            });
        }
    }
139872
public int bitrate_instant(){
    int _link=(seekable ? current_link : 0);
    if(samptrack==0)
      return (-1);
    int ret=(int)(bittrack/samptrack*vi[_link].rate+.5);
    bittrack=0.f;
    samptrack=0.f;
    return (ret);
  }
727501
def pixelFormat(self):
        
        f=None
        if self.isVideo():
            if self.__dict__['pix_fmt']:
                f=self.__dict__['pix_fmt']
        return f
147923
public Integer[] getSupportedSampleRates() {
		IntPointer sampleRatesPointer = avCodec.supported_samplerates();

		if (getType() != MediaType.AUDIO || sampleRatesPointer == null)
			return null;

		List<Integer> sampleRates = new ArrayList<Integer>();

		int sampleRate;
		int index = 0;
		while ((sampleRate = sampleRatesPointer.get(index++)) != 0)
			sampleRates.add(sampleRate);

		// ascending order
		Collections.sort(sampleRates);

		return sampleRates.toArray(new Integer[0]);
	}
631861
def on_execute__set_video_config(self, request):
        '''
        
        '''
        data = decode_content_data(request)
        compare_fields = ['device_name', 'width', 'height', 'name', 'fourcc',
                          'framerate']
        if data['video_config'] is None or not data['video_config'].shape[0]:
            i = None
        else:
            for i, row in self.parent.video_mode_slave.configs.iterrows():
                if (row[compare_fields] ==
                        data['video_config'][compare_fields]).all():
                    break
            else:
                i = None
        if i is None:
            logger.error('Unsupported video config:\n%s', data['video_config'])
            logger.error('Video configs:\n%s',
                         self.parent.video_mode_slave.configs)
            self.parent.video_mode_slave.config_combo.set_active(0)
        else:
            logger.error('Set video config (%d):\n%s', i + 1,
                         data['video_config'])
            self.parent.video_mode_slave.config_combo.set_active(i + 1)
732345
private StreamConfiguration adjustConfigurations(AudioFormat format) {
    int sampleRate = (int) format.getSampleRate();
    int sampleSize = format.getSampleSizeInBits();
    int channels = format.getChannels();

    StreamConfiguration streamConfiguration = new StreamConfiguration();
    streamConfiguration.setSampleRate(sampleRate);
    streamConfiguration.setBitsPerSample(sampleSize);
    streamConfiguration.setChannelCount(channels);

    return streamConfiguration;
  }