2012-06-02 3 views
0

서버에서 AAC (오디오 콘텐츠)를 스트리밍하려고합니다. 플레이어는 문제없이 시작하고 얼마 후 OutOfMemoryError를 throw합니다. 나는 오디오를 버퍼링해야한다고 생각한다. 어느 누구라도 나를 구현 (또는이 오류 제거) 가이드로 안내해주십시오.오디오 스트리밍 OutOfMemoryError

여기 내 코드입니다.

`HttpConnection c = null; 
    InputStream is = null; 
    try { 
     c = (HttpConnection) Connector.open(streamURL, 
       Connector.READ_WRITE); 
     int rc = c.getResponseCode(); 
     System.out.println("Response Code " + rc); 

     if (rc != HttpConnection.HTTP_OK) { 
      showAlert("Server error returned"); 

     } else { 
      playerForm.append("openInputStream"); 
      is = c.openInputStream(); 
      player = Manager.createPlayer(is, "audio/aac"); 
      player.realize(); 

      // get volume control for player and set volume to max 
      VolumeControl vc = (VolumeControl) player.getControl("VolumeControl"); 
      if(vc != null) 
      { 
       vc.setLevel(100); 
      } 


      player.prefetch(); 

      player.start(); 
     } 
    } catch (Exception f) { 
     playerForm.append("Exception in player " + f.getMessage() + "\n"); 
    } finally { // Aufräumarbeiten ausführen 
     if (is != null) 
      try { 
       is.close();     
      } catch (IOException e) { 
      } 
     if (c != null) 
      try { 
       c.close();     
      } catch (IOException e) { 
      } 
    }` 

미리 감사드립니다.

감사합니다. Anish.

답변

3

catch의 예외 대신 Throwable 클래스를 사용하면 OutOfMemoryError를 처리합니다.