-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add interactive pause/resume functionality #14
Add interactive pause/resume functionality #14
Conversation
We need to reset the file cursor to the beginning of the file. Initially, the program would simply get stuck polling the compress fd. This was probably because of the fact that the codec would hang because of the fact that it was expecting to receive the MP3 data along with its associated MP3 header. This was not the case for the first (header, data) pair because, after parsing the first header, the file cursor would point at the beginning of the data region. By resetting the file cursor to the beginning of the file, the codec will receive all the (header, data) pairs it actually expects. Suggested-by: Shengjiu Wang <shengjiu.wang@nxp.com> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
0086823
to
57096e5
Compare
57096e5
to
9df3708
Compare
Update
|
@perexg @vinodkoul can you please help review this? |
9df3708
to
16cb691
Compare
Update:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @dbaluta noted, the aplay tool supports Space and Enter ('\r'
) keys for the pause operation.
Otherwise the change looks fine in my eyes.
16cb691
to
153e1a0
Compare
@perexg Should be fine now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/utilitary/utility
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, few nitpciks though
153e1a0
to
96c46c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggesting avoiding the term 'resume', it leads to confusions between pause_push/pause_release and suspend/resume.
Also I am not sure what happens with compressed formats such as AAC_ADIF, where the information configuration is provided initially and not with a header. There might be a need to prevent the DSP from suspending to avoid losing context?
is_paused = true; | ||
break; | ||
case DO_RESUME: | ||
if (compress_resume(compress) != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compress_pause_release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be addressed in another series of patches as this one doesn't actually introduce compress_resume()
but it just uses it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, this should be done as a different change
96c46c8
to
175b8ff
Compare
We want to be able to pause and resume the stream just like the ALSA utilitary aplay does. In order to do so, we first need to mark the read operations on stdin as nonblocking and then enable the noncanonical mode for the terminal. What this does is it makes the read operations nonblocking and it makes the input available immediately. After doing so, we can check if we receive a SPACE or ENTER character from user and do pause/resume depending on current stream state (and by this I mean if the stream is currently paused and we receive a SPACE or ENTER then we resume it and vice-versa) Signed-off-by: Maurine Creton <maurine.creton@nxp.com> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
@vinodkoul @plbossart @perexg I think we are good with this. All the comments have been addressed. |
We want to be able to interactively pause and resume the stream.
Initially, when trying to play an MP3 song, cplay would hang during the polling on compress_write. The cause for this was the fact that, after calling
get_codec_mp3
, the file pointer would point to the first MP3 data, leaving out the first MP3 header. I'm assuming that this would cause the codec to be unable to process the received frames since it wouldn't be able to find the first MP3 header.In order to be able to use the pause/resume functionality on MP3 streams, this problem had to be addressed before adding the actual functionality.